22
MICS Data Processing Workshop CSPRO Applications

MICS Data Processing Workshop CSPRO Applications

Embed Size (px)

Citation preview

Page 1: MICS Data Processing Workshop CSPRO Applications

MICS Data Processing Workshop

CSPRO Applications

Page 2: MICS Data Processing Workshop CSPRO Applications

Creating a Data Entry Application

We’ll now create a data entry application The application will make use of the test

dictionary and form Before creating the application, I’ll briefly

discuss– order of operations in CSPRO– data entry path– most common data entry commands

Page 3: MICS Data Processing Workshop CSPRO Applications

CSPRO Procedure Types

– Global procedure (proc global) logic executed when application begins/ends

– Form file procedure (proc form_file_name) logic executed before/after each case

– Level procedure (proc level_name) logic executed before/after level

– group procedure (proc group_name) logic executed before/after a form or roster

– variable procedure (proc variable_name) logic executed before/after variable’s field entered

Page 4: MICS Data Processing Workshop CSPRO Applications

Preproc and Postproc

Procedures are broken into two parts– Preproc

logic executed before item for example, skip a variable

– Postproc logic executed after item for example, check if data entered is consistent for example, skip to a variable

If no explicit statement, logic is in the postproc by default

Page 5: MICS Data Processing Workshop CSPRO Applications

Order of Operations

Global proc Form file preproc

– Level 1 preproc Form 1.1 preproc

– Field 1.1.1 preproc– Field 1.1.1 postproc– ...other form 1 fields

Form 1.1 postproc ...other level 1 forms Level 2 preproc

– Form 2.1 preproc Field2.1.1 preproc Field 2.1.1 postproc

– Form 2.1 postproc– ...other level 2 forms

Level 2 postproc

– Level 1 postproc

Form file postproc

Page 6: MICS Data Processing Workshop CSPRO Applications

The Data Entry Path

The data entry path contains all of the questions that a respondent should be asked

It is determined by– the type of the questionnaire– the responses to questions in conjunction

with questionnaire skips questionnaire filters

Page 7: MICS Data Processing Workshop CSPRO Applications

Controlling the Data Entry Path

CSPRO allows one to control completely the data entry path

The first step is to– open DE application– go to options --> data entry– select system controlled– (while you are there, make all alphanumeric

variables upper case)

Page 8: MICS Data Processing Workshop CSPRO Applications

Questionnaire Skips

CSPRO has 2 ways of implementing skips– The skip to command

if the variable being skipped to is in a single record To skip to a variable or group useskip to variable_name;

skip to group_name;

– The skip to next command if the var. being skipped to is in a multiple record

Page 9: MICS Data Processing Workshop CSPRO Applications

Reentering

To force the data entry operator to reenter a field (e.g., if the data entered are inconsistent) usereenter;

Page 10: MICS Data Processing Workshop CSPRO Applications

if command

Use to check for a condition:if HH9 <> 1 then

skip to HH16;endif;

if not HH6 in 1,2 thenreenter;

endif;

Page 11: MICS Data Processing Workshop CSPRO Applications

Ending a Level

You must manually end a level if– the last variable in the data path is not the

last variable on the questionnaire– you have entered the last woman or under-

five questionnaire This is accomplished using the endlevel

command

Page 12: MICS Data Processing Workshop CSPRO Applications

The ENDLEVEL Command

The effect of the endlevel command depends upon its context– In field/roster/form proc, passes control to the

level postproc– In level preproc or postproc, passes control to

postproc of next highest level– In postproc of level 1, pass control to the

form file’s postproc

Page 13: MICS Data Processing Workshop CSPRO Applications

Ending a Group

A group is a record or roster A group is ended by the endgroup command The effect of the command depends upon

context:– In an item procedure, passes control to the

current group’s postproc– In the preproc of the group, skips the entire group

and passes control to the group’s postproc

Page 14: MICS Data Processing Workshop CSPRO Applications

Working Variables

Working variables must be declared in the global procedure

Numeric working variables can be declared together– numeric var1 var2;

Alphanumeric working variables are declared separately– alpha(length) avar1;– alpha(length) avar2;

Page 15: MICS Data Processing Workshop CSPRO Applications

Setting Parameters

Global parameters should be declared in the preproc of the forms procedure– e.g., minimum age at first birth

Assign a value to a working variable created for the purpose

Comment your parameter using braces For example

– minab = 144; {minimum age at first birth in months}

Page 16: MICS Data Processing Workshop CSPRO Applications

Recoding Variables

To recode variables, use the recode command

The following logic recodes women’s age into groupsrecode WM9 => agegrps;

15-19 => 1;

20-24 => 2;

=> 3;

endrecode;

Page 17: MICS Data Processing Workshop CSPRO Applications

Generating Error Messages

If the cluster number is invalid, the following code will display an error message

errmsg(0010);

Page 18: MICS Data Processing Workshop CSPRO Applications

Providing an Error Message

Error messages must have user-defined text to be effective

For the preceding example, one would add a line0010 cluster number invalid

To view the error message file– to do so, right click on the message tab while

editing a procedure’s logic

Page 19: MICS Data Processing Workshop CSPRO Applications

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

Page 20: MICS Data Processing Workshop CSPRO Applications

Creating the Application

Select file --> new Select object type data entry application Use file name: test Use folder: c:\mics\cspro\test Click next Click yes when prompted to use the test

form Click finish

Page 21: MICS Data Processing Workshop CSPRO Applications

Modifying the Application

Add logic to– check the household number is consistent

display message and data entry if not

– implement the region skip – check the date of interview is consistent

display message and require reentry if not

Compile and then save your application

Page 22: MICS Data Processing Workshop CSPRO Applications

Testing the Application

Click once on execute button on toolbar (traffic light)

Use nodata.dat datafile Enter a case