5. cspro applications

Upload: ho-van-bao

Post on 03-Apr-2018

393 views

Category:

Documents


8 download

TRANSCRIPT

  • 7/28/2019 5. CSPRO Applications

    1/22

    MICS Data Processing Workshop

    CSPRO Applications

  • 7/28/2019 5. CSPRO Applications

    2/22

    Creating a Data Entry Application

    Well now create a data entry application

    The application will make use of the testdictionary and form

    Before creating the application, Ill brieflydiscuss

    order of operations in CSPRO

    data entry path

    most common data entry commands

  • 7/28/2019 5. CSPRO Applications

    3/22

    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 variables field entered

  • 7/28/2019 5. CSPRO Applications

    4/22

    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

  • 7/28/2019 5. CSPRO Applications

    5/22

    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

  • 7/28/2019 5. CSPRO Applications

    6/22

    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

  • 7/28/2019 5. CSPRO Applications

    7/22

    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 alphanumericvariables upper case)

  • 7/28/2019 5. CSPRO Applications

    8/22

    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

  • 7/28/2019 5. CSPRO Applications

    9/22

    Reentering

    To force the data entry operator to reenter a

    field (e.g., if the data entered are inconsistent)usereenter;

  • 7/28/2019 5. CSPRO Applications

    10/22

    if command

    Use to check for a condition:

    if HH9 1 thenskip to HH16;

    endif;

    if not HH6 in 1,2 thenreenter;

    endif;

  • 7/28/2019 5. CSPRO Applications

    11/22

    Ending a Level

    You must manually end a level if

    the last variable in the data path is not the lastvariable on the questionnaire

    you have entered the last woman or under-fivequestionnaire

    This is accomplished using the endlevelcommand

  • 7/28/2019 5. CSPRO Applications

    12/22

    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

  • 7/28/2019 5. CSPRO Applications

    13/22

    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 groupand passes control to the groups postproc

  • 7/28/2019 5. CSPRO Applications

    14/22

    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 declaredseparately alpha(length) avar1;

    alpha(length) avar2;

  • 7/28/2019 5. CSPRO Applications

    15/22

    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 createdfor the purpose

    Comment your parameter using braces

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

  • 7/28/2019 5. CSPRO Applications

    16/22

    Recoding Variables

    To recode variables, use the recode command

    The following logic recodes womens age intogroupsrecode WM9 => agegrps;

    15-19 => 1;

    20-24 => 2;

    => 3;

    endrecode;

  • 7/28/2019 5. CSPRO Applications

    17/22

    Generating Error Messages

    If the cluster number is invalid, the following

    code will display an error message

    errmsg(0010);

  • 7/28/2019 5. CSPRO Applications

    18/22

    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 procedures logic

  • 7/28/2019 5. CSPRO Applications

    19/22

    Error Message Parameters

    The values of any variables listed after the

    error message number will be passed to theerror message

    Parameters are displayed in the error messageusing

    %d for numeric values %s for alphanumeric values

  • 7/28/2019 5. CSPRO Applications

    20/22

    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

  • 7/28/2019 5. CSPRO Applications

    21/22

    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

  • 7/28/2019 5. CSPRO Applications

    22/22

    Testing the Application

    Click once on execute button on toolbar (traffic

    light) Use nodata.dat datafile

    Enter a case