Multiple Indicator Cluster Surveys MICS3 Regional Training Workshop
Multiple Indicator Cluster Surveys Data Processing Workshop
description
Transcript of Multiple Indicator Cluster Surveys Data Processing Workshop
![Page 1: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/1.jpg)
Multiple Indicator Cluster SurveysData Processing Workshop
Data Entry Applications with Logic
MICS Data Processing Workshop
![Page 2: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/2.jpg)
Topics to be Discussed
• what is the “path” of data entry?• skip and reenter• manipulating the path via procedures• processing order in CSPro• more commonly-used CSPro commands• creating user-defined variables• adding messages to your program
![Page 3: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/3.jpg)
The Data Entry Path• The data entry path contains all of the questions that
a respondent should be asked and observed • It is determined by
– the type of the questionnaire– the responses to questions in conjunction with
• questionnaire skips• questionnaire filters
• It is controlled by logic you develop
![Page 4: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/4.jpg)
Changing the path via skipCSPro has two ways of implementing skips:skip to
Use if moving to a singly-occurring variable or to a roster:skip to <variable_name>;skip to <group_name>;
skip to nextUse if the var. being skipped to is in a repeating form/roster:skip to next <repeating_variable_name>;skip to next <group_name>;
![Page 5: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/5.jpg)
Changing the path via reenter
• To force the data entry operator to reenter the current field (e.g., if the data entered are inconsistent) use:
reenter;• By default, reenter forces reentry of the
current field. If you wish to force reentry of a previously-entered field, use:
reenter <field_name>;
![Page 6: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/6.jpg)
CSPro Procedure Types
Global procedure (PROC GLOBAL)• logic executed when the Data Entry App begins
Form File procedure (PROC <form_file_name>)• logic executed when the Data Entry App begins/ends
Level procedure (PROC <level_name>)• logic executed when a level begins/ends
Group procedure (PROC <group_name>)• logic executed when a form/roster begins/ends
Variable procedure (PROC <variable_name>)• logic executed before/after a variable is keyed
![Page 7: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/7.jpg)
preproc and postproc
There are two types of procedures:preproc
• logic executed before the item• for example, skip to another variable
postproc• logic executed after item• for example, check if data entered is consistent• for example, skip to a variable• default action for logic if nothing explicitly written
![Page 8: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/8.jpg)
Order of OperationsPROC GLOBAL (executes at start of program, cannot stipulate preproc or postproc)Form File preproc
Level 1 preprocForm 1.1 preproc
Field 1.1.1 preprocField 1.1.1 postprocrepeat for other <Form 1.1 fields>
Form 1.1 postprocrepeat for other <Level 1 forms>
Level 2 preprocForm 2.1 preproc
Field 2.1.1 preprocField 2.1.1 postproc
Form 2.1 postprocrepeat for other <Level 2 forms>
Level 2 postprocLevel 1 postproc
Form File postproc
![Page 9: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/9.jpg)
Ending a Level
• You must prematurely finish a level if– the last variable in the data path is not the last
variable on the questionnaire– there are no more woman or children’s
under-five questionnaires left for the HH• This is accomplished using the endlevel
command
![Page 10: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/10.jpg)
The endlevel Command
• The effect of the endlevel command depends upon its context/location:– In a field/roster/form proc, control passes to the
current level’s postproc– In a level 2 or higher postproc, control passes to
the next highest level’s postproc– In a level 1 proc, control passes to the application,
i.e., the form file’s postproc
![Page 11: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/11.jpg)
Operator vs. System Controlled
• Operator-controlled: the keyer has some/ all control on the data entry path
• System-controlled: the keyer has no control over the data entry path– go to options data entry – choose “system controlled”– (while you are there, make all alphanumeric
variables upper case)
![Page 12: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/12.jpg)
Ending a Group• A group is a roster or multiply-occurring form• Is terminated by using the endgroup
command• Passes control to the group’s postproc—all
intervening logic (in other form/roster items) is skipped
![Page 13: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/13.jpg)
User-defined Variables• User-defined variables must be declared in the PROC GLOBAL section and as implied, are global in scope
• Numeric working variables can be declared together– numeric var1, var2;
• Alphanumeric variables must be declared separately:– alpha(length) avar1;– alpha(length) avar2;
![Page 14: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/14.jpg)
User-defined Variables (cont)
• All variables must be declared in the preproc of the form_files procedure
• User-defined variables should be assigned a value within the preproc of the form_files, e.g., minab = 144;
• You should give a description of your variable at either the place of declaration or initialization, e.g.,numeric minab; {min. age at first birth in months}
![Page 15: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/15.jpg)
Recoding Variables• To more easily assign values to a variable based on
another variable, use recode• The following logic recodes women’s age into groups:
recode WB2 => agegrps;15-19 => 1;20-24 => 2;
=> 3;endrecode;
![Page 16: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/16.jpg)
if command
Use the if command to check for a condition:if HH9 <> 1 thenskip to HH16;
endif;
if (HH9=1 and HH11=0) or (HH9 in 2:4,6 and HH11<>0) thenreenter;
endif;
![Page 17: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/17.jpg)
Generating Error Messages• Example: If the cluster number is invalid, we can
show the operator a message to explain what the problem is; for example,
errmsg(“Cluster number invalid”);• However, to be more useful, we should tell them
what the valid range is; to do this, we can pass in parameters to the command as follows:
errmsg(“Cluster number invalid, expected range %d to %d”, MinClust, MaxClust);
![Page 18: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/18.jpg)
Error Message Parameters
• The values of any variables listed after the error message number will be passed to the error message
• Parameters are displayed in the error message using– %d for numeric values– %s for alphanumeric values (i.e., text)
![Page 19: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/19.jpg)
Streamlining Error Messages
• Suppose we need to repeat the same message several times in the file—what should we do?
• We can assign unique numbers to each error message
• We can keep all error messages in the message file (.mgf)
![Page 20: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/20.jpg)
Sample Error Messages• Our earlier message (and maybe one we could use
for that HH result code earlier) would now be simplified to:errmsg(1, MinClust, MaxClust);errmsg(2, HH9, HH11);
• And the message file would look something like:
0001 Cluster number invalid, expected range %d to %d0002 HH result code (%d) doesn’t agree with number of
HH members (%d)
![Page 21: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/21.jpg)
Modifying Your Test Application
• Add logic to– check if the household number is consistent
• display message and add reenter command if not– implement the HH result code skip – check the date of interview is internally consistent
• display message and force reentry if not• Compile your application, resolve any errors• Save your application (<ctrl+S>)
![Page 22: Multiple Indicator Cluster Surveys Data Processing Workshop](https://reader036.fdocuments.in/reader036/viewer/2022062410/5681649e550346895dd685e5/html5/thumbnails/22.jpg)
Testing your Application
• Click once on the execute button on toolbar ( ), or press <ctrl+R> to run
• Use NoData.dat as your datafile• Enter a case (i.e., a questionnaire)