Sie sind auf Seite 1von 22

MICS Data Processing Workshop

CSPRO Applications

Creating a Data Entry Application


Well now create a data entry application The application will make use of the test dictionary and form Before creating the application, Ill briefly discuss

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

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


logic executed before/after level logic executed before/after a form or roster logic executed before/after variables field entered

Level procedure (proc level_name)

group procedure (proc group_name)

variable procedure (proc variable_name)

Preproc and Postproc

Procedures are broken into two parts

Preproc

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

Postproc

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

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

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

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)

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 use skip to variable_name; skip to group_name;

The skip to next command

if the var. being skipped to is in a multiple record

Reentering

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

if command

Use to check for a condition:


if HH9 <> 1 then skip to HH16; endif; if not HH6 in 1,2 then reenter; endif;

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

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 files postproc

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 groups postproc In the preproc of the group, skips the entire group and passes control to the groups postproc

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;

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}

Recoding Variables

To recode variables, use the recode command The following logic recodes womens age into groups
recode WM9 15-19 20-24 endrecode; => => => => agegrps; 1; 2; 3;

Generating Error Messages

If the cluster number is invalid, the following code will display an error message
errmsg(0010);

Providing an Error Message


Error messages must have user-defined text to be effective For the preceding example, one would add a line
0010 cluster number invalid

To view the error message file

to do so, right click on the message tab while editing a procedures logic

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

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

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

Testing the Application


Click once on execute button on toolbar (traffic light) Use nodata.dat datafile Enter a case

Das könnte Ihnen auch gefallen