Batch to catch spesific Case ID

Discussions about editing and cleaning data
Forum rules
New release: CSPro 8.0
langitluna
Posts: 32
Joined: December 4th, 2016, 10:57 pm

Batch to catch spesific Case ID

Post by langitluna »

Greeting All

Anyone can give me example of batch to catch only particular case base on case ID (as unique one) ?
My case id field name : Case_ID. I want to catch some cases for only some specific cases.
Ex Case_id 10,13,12,100 on output.dat

Your help very appreciate.

Thank you
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Batch to catch spesific Case ID

Post by josh »

What do you mean by "catch"? Do you want to print out those cases? save them to the output file?
langitluna
Posts: 32
Joined: December 4th, 2016, 10:57 pm

Re: Batch to catch spesific Case ID

Post by langitluna »

Hi Josh
i mean I want to get the output of entry result with particular case Id, all fields within dictionary.
So if I have 100 cases on output.txt with case _I'd 1 - 100.:
What if I want only cases with case_id: ex 1 , 3, 10,50,97. The output on entry mode only that case.
Thanks Josh
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Batch to catch spesific Case ID

Post by josh »

You can use the skip case command to skip the cases that you don't want:

Code: Select all

if not case_id in 1, 3, 10, 50, 97 then
   skip case;
endif;
langitluna
Posts: 32
Joined: December 4th, 2016, 10:57 pm

Re: Batch to catch spesific Case ID

Post by langitluna »

Brother Josh
Thx you very much. Can this such logic I add in batch to:
- delete the case
- Separate the case by other fields like demographic field ex city, age etc
So the logic would be like : if city in 1, 2 then skip case
Thx and very appreciate
langitluna
Posts: 32
Joined: December 4th, 2016, 10:57 pm

Re: Batch to catch spesific Case ID

Post by langitluna »

Brother Josh

>>You can use the skip case command to skip the cases that you don't want:
=============
if not case_id in 1, 3, 10, 50, 97 then skip case;
endif;
==============

Yes this logic perfectly well.

What if I want only case_id 1, 3, 10, 50, 97 ?

Thx
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Batch to catch spesific Case ID

Post by josh »

Remove the "not"
langitluna
Posts: 32
Joined: December 4th, 2016, 10:57 pm

Re: Batch to catch spesific Case ID

Post by langitluna »

Brother Josh

I have tried, but its not work.
I have attached the zip file. Would you please see it.

//In DATA_ALL.DAT has 10 cases with ID (RESP_ID): 1,2,3,10,22,99,97,56,21,50
//I want only this ID : 1, 3, 10, 50, 97 DATA_OUTPUT.dat
Attachments
ABC.zip
(9.88 KiB) Downloaded 365 times
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Batch to catch spesific Case ID

Post by Gregory Martin »

You put that code in the application-level PROC, which gets run only one for your whole run. You need to put the code in a PROC that gets run for every case. See below:
PROC ABC_QUEST

preproc

    if not RESP_ID in 1, 3, 10, 50, 97 then
        skip case;
    endif;
langitluna
Posts: 32
Joined: December 4th, 2016, 10:57 pm

Re: Batch to catch spesific Case ID

Post by langitluna »

Ahaa. Now it is worked. Thx my brother.
One question about this: in batch :
if I have a skewed data, I mean the data is unclean yet, ex bad record because off wrongly key in ; will effect to the output batch? thanx Gregory , .
Post Reply