Multiple Indicator Cluster Surveys Data Processing Workshop Built-In and User-Defined Functions MICS Data Processing Workshop.

Slides:



Advertisements
Similar presentations
Multiple Indicator Cluster Surveys MICS3 Regional Training Workshop Womens Information Panel.
Advertisements

MICS4 Data Processing Workshop Multiple Indicator Cluster Surveys Data Processing Workshop CSPro Overview.
MICS4 Data Processing Workshop Multiple Indicator Cluster Surveys Data Processing Workshop Data Entry Editing.
MICS DATA PROCESSING Data Entry Editing. REMEMBER AND REMIND YOUR FIELD STAFF: The best place to correct data is in the field where the respondent is.
MICS4 Data Processing Workshop Multiple Indicator Cluster Surveys Data Processing Workshop Built-In and User-Defined Functions.
MICS4 Data Processing Workshop Multiple Indicator Cluster Surveys Data Processing Workshop Data Entry Applications with Logic.
MICS Data Processing Workshop
MICS Data Processing Workshop
MICS Data Processing Workshop User-Defined and Built-In Functions.
MICS DATA PROCESSING Secondary Editing. REMEMBER AND REMIND YOUR FIELD STAFF: The best place to correct data is in the field where the respondent is available.
MICS4 Data Processing Workshop Multiple Indicator Cluster Surveys Data Processing Workshop Revisiting Data Path and Error Messages in a Data Entry Application.
MICS4 Data Processing Workshop Multiple Indicator Cluster Surveys Data Processing Workshop MICS Dictionary and Forms.
MICS4 Data Processing Workshop Multiple Indicator Cluster Surveys Data Processing Workshop Secondary Editing.
Multiple Indicator Cluster Surveys Data Processing Workshop Data Entry Applications with Logic MICS Data Processing Workshop.
Topics Introduction Types of Errors Exceptions Exception Handling
A MATLAB function is a special type of M-file that runs in its own independent workspace. It receives input data through an input argument list, and returns.
CLINIC MANAGEMENT SYSTEM APPOINTMENT SCHEDULING. How will this start? Any schedules already built will not be carried over to the CMS Portal You will.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Multiple Indicator Cluster Surveys Data Processing Workshop MICS Dictionary and Forms MICS Data Processing Workshop.
Multiple Indicator Cluster Surveys Data Processing Workshop
Java Programming, 3e Concepts and Techniques Chapter 4 Decision Making and Repetition with Reusable Objects.
MICS Data Processing Workshop Multiple Indicator Cluster Surveys Data Processing Workshop Data Quality Tables.
Lesson 4 Cell Reference Formulas. Working with Cell References continued… Relative Cell Reference A relative cell reference means that the cell value.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
9/18/2015Slide 1 The homework problems on comparing central tendency and variability extend the focus central tendency and variability to a comparison.
1 Web-Enabled Decision Support Systems Objects and Procedures Don McLaughlin IE 423 Design of Decision Support Systems (304)
Multiple Indicator Cluster Surveys Data Processing Workshop Secondary Editing MICS Data Processing Workshop.
Lesson 5 Using FunctionUsing Function. Objectives.
Copyright 2010, The World Bank Group. All Rights Reserved. Data Processing and Tabulation, Part I.
Model-Based Specification CIS 376 Bruce R. Maxim UM-Dearborn.
GUI development with Matlab: GUI Front Panel Components 1 GUI front panel components In this section, we will look at -GUI front panel components -Programming.
Multiple Indicator Cluster Surveys Data Processing Workshop CAPI Supervisor’s Menu System MICS Data Processing Workshop.
Flow of Control Part 1: Selection
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 5 Arrays.
1 Boolean Expressions to Make Comparisons Boolean expression –Represents only one of two states –Expression evaluates to either true or false Expressions.
Chapter 5: More on the Selection Structure Programming with Microsoft Visual Basic 2005, Third Edition.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
+ Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy Walters, and Godfrey Muganda Chapter 5: Looping.
11- 1 Chapter 11.  Avoiding Logic Errors by Validating Input  What to Do If Input Errors Occur  Global Considerations in COBOL  When Data Should Be.
Welcome to State of Michigan Central FinanceExpense Approval and Modification Tutorial Brought to you by the Office of Financial Management.
Welcome to State of Michigan Managerial and SupervisoryExpense Approval & Modification Approval & Modification Tutorial Brought to you by the Office of.
Working with Formulas and Functions
CHAPTER 10 ARRAYS AND FUNCTIONS Prepared by: Lec. Ghader Kurdi.
Chapter 11 Data Validation. Question Should your program assume the data is correct, or should your program edit the data to ensure it is correct?
MICS Data Processing Workshop Multiple Indicator Cluster Surveys Data Processing Workshop Creating Analysis Files: Description of Preparation Steps.
(Winter 2016) Instructor: Craig Duckett Lecture 13: Thursday, February 18 th Mere Mortals: Chap. 9 Summary, Team Work 1.
10 Chapter 101 Using Menus and Validating Input Programming Logic and Design, Second Edition, Comprehensive 10.
11- 1 Chapter 11.  Avoiding Logic Errors by Validating Input  What to Do If Input Errors Occur  Global Considerations in COBOL  When Data Should Be.
Module Four: Entering NT Data Into SIS. Introduction – Entering NT Data The Enter NT Data screen will enable you to enter NT data into SIS. From this.
Center for Surveillance, Epidemiology, and Laboratory Services Division of Health Informatics and Surveillance José Aponte Public Health Advisor Adding.
Creating FunctionstMyn1 Creating Functions Function can be divided into two groups: –Internal (built in) functions –User-defined functions.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Multiple Indicator Cluster Surveys Data Processing Workshop Overview of SPSS structural check programs and frequencies MICS Data Processing Workshop.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
Working with Formulas and Functions Lesson 5 Part 1 1.
OPERATORS IN C CHAPTER 3. Expressions can be built up from literals, variables and operators. The operators define how the variables and literals in the.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 10 Using Menus and Validating Input.
(Winter 2017) Instructor: Craig Duckett
The Selection Structure
Chapter 5: Looping Starting Out with C++ Early Objects Seventh Edition
Control Statement Examples
Variables and Arithmetic Operations
Conditions and Ifs BIS1523 – Lecture 8.
Chapter 3 The DATA DIVISION.
Working with Formulas and Functions
Chapter 3: Selection Structures: Making Decisions
Boolean Expressions to Make Comparisons
Chapter 3: Selection Structures: Making Decisions
Working with Formulas and Functions
Presentation transcript:

Multiple Indicator Cluster Surveys Data Processing Workshop Built-In and User-Defined Functions MICS Data Processing Workshop

Built-In Functions CSPro has a wide range of built-in functions They are not accessible for modification Most built-in functions are well-documented in the help system –You can see a list of these functions by searching on “Alphabetical List of Statements and Functions” within the help system’s index tab –We'll discuss some of the other functions which are not documented

Century Month Code (CMC) Makes date calculations easier to handle January 1900 = CMC 1 December 1900 = CMC 12 January 1901 = CMC 13 April 2000 = CMC 1204 April 2001 = CMC 1216 CMC = (Year-1900)*12 + Month

The cmcode Function Purpose: calculate the CMC of a month/year Syntax: cmcode(month,year) Returns: –if month and year valid: CMC of the month/year provided –if month or year is invalid: 9999 (invalid means month or year is equal to DK, missing)

The setlb Function Purpose: calculate the lower CMC bound for an event Syntax: setlb(month,year,minimum) Returns: –if month and year valid: CMC of month/year –if month invalid: CMC of 1/year –if year invalid: minimum

The setub Function Purpose: calculate the upper CMC bound for an event Syntax: setub(month,year,maximum) Returns: –if month and year valid: CMC of month/year –if month invalid: CMC of 12/year –if year invalid: maximum

Example of setlb and setub Suppose: WB1M = 98; WB1Y = 1962; Using setlb and setub, set local variables dobLB & dobUB (DOB lower/upper bound) as follows: dobLB = setlb(WB1M,WB1Y,0);  745 dobUB = setub(WB1M,WB1Y,9999);  756

The adjlba Function Purpose: adjust lower CMC bound for an event using a person’s age; i.e., it calculates a minimum date of birth Syntax: adjlba(lcmc,ucmc,di,di,age) Arguments: –lcmc is the lower CMC bound of an event –ucmc is the upper CMC bound of event –di is the CMC date of interview Let’s denote the result as rlb (resulting lower bound)

The adjlba Function Calculates: rlb = di – age*12 – 11 we subtract 11 (months), because we assume the person just had their birthday and is therefore at the “bottom-end” of their age, with 11 more months to go before having another birthday Returns: if rlb in lcmc:ucmc  rlb if rlb < lcmc  lcmc if rlb > ucmc  -1 Example: woman born 98/1962; her age=47; date of interview = Aug 2009 adjlba (745,756,1316,1316,47)  741 ; however, this is below the given lcmc, and so rlb will be assigned 745

The adjuba Function Purpose: adjust upper CMC bound for an event using a person’s age; i.e., it calculates a maximum date of birth Syntax: adjuba(lcmc,ucmc,di,di,age) Arguments: –lcmc is the lower CMC bound of event –ucmc is the upper CMC bound of event –di is the CMC date of interview Let’s denote the result as rub (resulting upper bound)

The adjuba Function Calculates: rub = di - age*12 we make no adjustments to the person’s age, as we assume they are at the “top-end” of their age, with a birthday looming later this month or in the next month Returns: if rub in lcmc:ucmc  rub if rub > ucmc  ucmc if rub < lcmc  -1 Example: woman born 98/1962; her age=47; date of interview = Aug 2009 adjuba (745,756,1316,1316,47)  752 ; since this is lower than the given ucmc, rlb will be assigned 752

Example of adjlba and adjuba Suppose –WB1M = 98, WB1Y = 1975 and WB2 = 34 years dobLB = setlb(WB1M,WB1Y,0);  901 dobUB = setub(WB1M,WB1Y,0);  912 − DOI is 06/2009 so di = 1314 Using the lower and upper ranges in the adjxba functions below, we find that we can narrow the range of possible cmc birth dates to rlb=adjlba(dobLB,dobUB,di,di,WB2)  901 rub=adjuba(dobLB,dobUB,di,di,WB2)  906

User-Defined Function (UDF) UDFs are defined in the PROC GLOBAL block These functions do not need to be modified (except function vdvalid), but they do need to be understood

Data Checking UDFs There are four UDFs that assist with executing arithmetic operations: valid —checks if the value is not a special value, i.e., other (96), inconsistent (97), don’t know (98), or missing (99) NAtoZero —if a question has been skipped (assigning a value of ‘not applicable’ to that question) or is missing, this function will return 0 (zero), so that the question can be used in arithmetic equations notEq —a value-added <> command badspecial —ensures that Unit/Number questions are consistent with one another

The valid UDF Purpose: ensures that a variable has a valid value Syntax: valid ( xvar ) Returns: 1  if value of xvar is not “special” (i.e., is not equal to notappl ) and ≤ 95 0  otherwise

The NAtoZero UDF Purpose: permits one to use variables that could be “not applicable” in arithmetic equations Syntax: NAtoZero(xvar) Returns: 0  if value of xvar is not applicable  value of xvar otherwise

The notEq UDF Purpose: A value-added <> check. dvar is passed thru the NAtoZero function first before the <> test is made. Syntax: notEq(xvar,dvar) Returns: 1  if xvar <> NAtoZero (dvar) 0  otherwise

The badspecial UDF Purpose: Ensures that the Unit response is consistent with the Number response Syntax: badspecial(units,number) Returns: 1  if there is a problem, i.e., if U = 9 & N <= 90 or U <> 9 & N in 90:98 or U > 1 & N = 0 0  otherwise

Birth History UDFs There are three UDFs that concern the birth history ValidYr – like valid except for 4 digit years AfterInt – checks if a date is after the date of interview ndjlba – like adjlba with a slight change

The validyr UDF Purpose: ensures that a year variable has a valid year value Syntax: validyr ( xvar ) Returns: 1  if value of xvar is not “special” (i.e., is not equal to notappl or missing ) and ≤  otherwise

The AfterInt UDF Purpose: ensures that a date is before the date of interview Syntax: AfterInt ( vcheckm, vchecky ) Returns: 1  if vchecky > year of interview (WM6Y) or, (if vchecky = year of interview (WM6Y) and vcheckm > month of interview (WM6M) ) 0  otherwise

The ndjlba UDF Purpose: adjusts the lower bound a pair of century month code values for a date, based on the age reported (modified version of adjlba). Syntax: ndjlba(lcmc,ucmc,di,di,age) Returns: Same as for adjlba, but it avoids the possibility of producing a CMC that would imply the imputation of an age that is 1 year higher (possible with adjlba ).

Anthropometry UDFs There are seven UDFs that concern anthropometry The first six of these will not be discussed The seventh is named agemth It calculates a child’s age in months

The agemth UDF Purpose: calculates most accurate age in months possible (used for anthropometry) Syntax: agemth(bd,bm,by,id,im,iy) (i.e., child’s DOB and date of interview) Returns: –child’s age in months if child’s birth day, month, and year are valid –child’s age in months using 15 as day if only birth month and year are valid –9999 if only birth year is valid

Vaccination UDFs There are four UDFs in the data entry application that check the validity of the vaccination date: vdvalid, vdoi, vdob and vacgiven There are two more UDFs in the editing program that check the ordering of vaccination dates, which we’ll discuss now: vseq and vmatch

The vdvalid UDF Purpose: checks if the vaccination date is valid (look for !!! in the logic to adjust dates per your interview period) Syntax: vdvalid(vday,vmonth,vyear) Returns: 0  if vaccination date is valid 1  otherwise

The vdoi UDF Purpose: checks if the vaccination is not after the date of interview Syntax: vdoi(vday,vmonth,vyear) Returns: 0  if vaccination date before date of interview 1  otherwise

The vdob UDF Purpose: checks if the vaccination is not before the date of birth Syntax: vdob(vday,vmonth,vyear) Returns: 0  if vaccination date after date of birth 1  otherwise

The vacgiven UDF Purpose: checks if the vaccination is given or not Syntax: vacgiven (xvar) Returns: 1  if vaccination is given 0  otherwise

The vseq UDF (Editing Only!) Purpose: checks that sequential vaccinations are in the correct order (e.g., that Polio 1 is before Polio 2) Syntax: vseq(v1d,v1m,v1y,v2d,v2m,v2y) Returns: 0  if vaccination 1 was given before vaccination 2 (i.e., everything is ok) 1  otherwise

The vmatch UDF (Editing Only!) Purpose: check if vaccinations commonly given on the same date (e.g., Polio and DPT) were in fact given on the same date Syntax: vmatch(v1d,v1m,v1y,v2d,v2m,v2y) Returns: 0  if vaccinations given on the same date 1  otherwise

The endmess UDF Syntax: endmess() Action: in add mode displays options 1 “Review Questionnaire” 2 “Next Questionnaire” Returns: 1  if data entry operator selects “Review Questionnaire” option from menu 0  otherwise

The alphachk UDF Syntax: alphachk(alphamask) Input: acceptable values for an alphanumeric variable –e.g., for WS7 alphamask is “ABCDEFXZ” –e.g., for IR2 alphamask is “ABCXZ” –e.g., for MN2 alphamask is “ABCFGX” Assigned before entry to the function: alphavar

The alphachk UDF Actions: check responses in alphavar are in alphamask check responses in alphavar are in alphabetical order ensure if ? is in alphavar, then it is the only response in alphavar places each response in alphavar in the location defined by its subitem e.g., for WS7, “ ACEF” becomes “ A C EF ”

Net Roster UDFs There are three UDFs that concern the Insecticide Treated Nets (ITN) Roster Clear_labels – Clears array of labels used by SetNet SetNet – Prepares array of possible persons sleeping under net for display CheckNet – Checks validity of responses for persons sleeping under nets

The clear_labels UDF Syntax: clear_labels() Action: blanks out all entries in two arrays: –Labels = “” –Codes = notappl Used in preparation for setnet Returns: nothing

The setnet UDF Syntax: setnet(xvarname, curnet) Action: Creates a list of household members and their line numbers that have not already been reported as sleeping under a net. Returns: Nothing, but Arrays Codes and Labels are set to the line numbers of the household members not yet reported.

The checknet UDF Syntax: checknet(xvar, xvarname, curnet) Action: Checks the line number ( xvar ) given as sleeping under a net with the list of household members and ensures that they have not already been listed as sleeping under a net. Returns: Error message number  if an error was found 0  otherwise