Upload
bizimana-appolinaire
View
5.978
Download
24
Tags:
Embed Size (px)
Citation preview
TRAINING OF Cspro
On 21 s t to 22 , March 2015
Trainers : BIZIMANA Appolinaire
IMANISHIMWE Valentine
NTITANGURANWA Jacson
Every participant should be able to explain why Cspro as Software
To be aware of Cspro and its application
To perform data entry , exporting ,and other practical skills related to this software
PART 1:Introduction
What is CSPro?
The Census and Survey Processing System (CSPro) is asoftware package for entry, editing, tabulation, anddissemination of census and survey data.
CSPro combines the features of the:
Integrated Microcomputer Processing System (IMPS)and the Integrated System for SurveyAnalysis (ISSA)in aWindows environment.
6
CSPro lets you create,modify,and run data entry,batchediting,and tabulationapplicationsfrom a single,integrated development environment.It processes dataon a case basis (one or more questionnaires),where acase can consistof one or many data records.
The data are stored in (ASCII) text files described bydata dictionaries.
CSProprovides tools to view data and other text files,toview tables and thematic maps created by CSPro
CSProwas developed jointly by the U.S.Census Bureau,Macro International,and Serpro,SA,with major fundingfrom the U.S.Agency for International Development.
Census Bureau Involvement• U.S.Census Bureau has a long history of using technology to
process censuses,going back to Hollerith and the 1890census
• International Programs Center has been helping countriesprocess census data for decades
• Off-the-shelf software in the past was not affordable, not easyto use,or otherwise was not practical for some countrieswhere IPC worked
Integrated Microcomputer ProcessingSystem (IMPS)• Census Bureau developed and supported, with funding
principally from USAID• DOS-based,text-based,used a COBOL compiler to enhance
functionality• Several modules:
–
–
–
–
–
EntryEditingTabulation Variance Calculation Operational Control
9
• CSPro does not have the latter two modules (yet)
10
Combination of IMPS and ISSA• USAID was funding the development of two statistical
processing software packages:– IMPS– ISSA:Integrated System for SurveyAnalysis
• Developed by SERPRO and Macro International
• Both software packages were in need of an update to entertheWindows/GUI world
• CSPro combines the best features of both software packages:– The ease-of-use of IMPS– The advanced functionality and logic language of ISSA– Called:Census and Survey Processing System
CSPro in One Slide CSPro is a free software package used by hundreds of
organizations and tens of thousands of individuals forentering,editing, tabulating, and disseminating census andsurvey data.CSPro is designed to be as user-friendly and easyto use as possible,yet powerful enough to handle the mostcomplex applications. It can be used by a wide range ofpeople,from non-technical staff assistants to seniordemographers and programmers.The funding for CSProcomes from USAID.
1
Release History CSPro 2.0 (the first version) released on May 5,2000
CSPro 3.x (2005) included a much more powerful tabulationsystem
CSPro 4.0 (2008) added support for PDA devices
CSPro 4.1 (2011) added additional tools for CAPI operationson portable computers such as tablets
•Most recent version (CSPro 6.0.1) released on september25,2014
Worldwide Use Used in over 160 countries by:
National Statistical Offices NGOs Universities Hospitals Militaries Businesses
Has processed the census data for countries as varied asDjibouti (less than one million people) to Bangladesh (over150 million people)
CSPro Processes…
Censuses (population and housing; agriculture; andeconomic)
Demographic and labor force surveys
Household income and expenditure surveys
Major international projects such as: Demographicand Health Surveys (DHS),Macro International Living Standards Measurement Study (LSMS),World Bank Multiple Indicator Cluster Survey (MICS),UNICEF
Future?
IMPS to CSPro marked the transition from DOS toWindows
With low-cost computers proliferating (tablets,smartphones),will there be another paradigm shift in thefuture?
Cost CSPro is free and will be forever
Some software packages charge both designer andimplementer fees
Some software packages charge by number of data collectionpoints
7
Support Census Bureau provides free support for CSPro via email:
There are CSPro consultants available for hire,though notmany
Many applications have been created,though few available onthe Internet
Very few Internet websites devoted to CSPro
18
Platform Works on any modern machine with MicrosoftWindows
Data entry can be done,one question at a time,onWindowsMobile PDAs (versions 5 and 6,notWindows Phone 7)
The growth and activity in low cost tablets and smartphonesis not centered aroundWindows
No way to turn applications into Internet applications
Robustness Has been tested and used for over ten years
Can handle census-sized applications
Can export data to major statistical software formats,andoften is used in combination with other programs
Most major bugs have been fixed,though some known bugs(generally minor) remain
0
Data File
Flat file,text-based format Advantages:
Human readablePossibleto create and modify without a data entry
application
2
2
Data File (continued) Disadvantages:
Large file sizes,though smaller when compressed Extra files (e.g.,an index) must be stored as separate files Modifying an entry can force the whole file to be rewritten Fixed width fields mean that changing a dictionary means
reformatting existing files Inability to store variable-length text Processing is slower Not compliant with common database programs and languages,
e.g.,SQL Only one user can write to a file at any given time
Key-from-imagenot supported natively3
Keyed Data Entry
CSProwas specificallydesigned for keyed data entry Can track the rates of keyers A verification operation can be established Has two modes that dictate how much control a keyer
has over an operation:operator- and system- controlledmodes
Operationalcontrol of files can be challenging to newusers,particularlyif managingan operation with manykeyers
Not ideal for keying letters unless they are Latin letters
CAPI Data Entry SupportsCAPI controls (e.g.,radio buttons) but as popup
windows,not built into the form No UNICODE support,though kludges mean CSPro can
supportdata entry in most languages Subject-oriented,non-linear,data entry is difficult to
program Designingthe dictionary,forms,and data entry is done in
three places,rather than all integrated
24
Logic Language
Robust,and designed specifically for data entry and processing Easy tasks are simple to program and require few programming
skills
Some tasks could be programmed more cleanly in an object-oriented frameworkSimple debugging (tracing) is possible,but dynamic modificationof the code is not,requiring a rebuild of the application for anysmall changeThe syntax of features added later (e.g.,CAPI functions) issometimes awkwardCan run slowly as it is an interpreted language
25
Inability to include standard modules across many applications
Editing and Tabulation Editing module is specifically designed for census editing, an
uncommon task
Tabulation is simple,drag and drop, and can create complextables with some programming
Area processing
Inability to perform complex analysis via the tabulationmodule
Editing,and especially tabulation, are slow when run on largedata sets
26
Missing Modules
Census variance
Operational control system for data entry,and for applicationdesign
Cleaner interface with industry standard GIS products, ratherthan the built-in MapViewer
Dictionary(Defining the Structure of your Data) Identification items uniquely identify the
questionnaire Items(describes a response to a question) Value Sets which are used to ranges of valid
values during data entry and even categories of data
PART 2:Dealing with CSPro 4.11. Create a Data Entry ApplicationStep 1:Examine theTutorial Questionnaire
The tutorial exercises are based on a sample questionnaire. InTasks 1 through 6 we will create a data entry application,
key some data,then tabulate the data. InTasks 7 and 8 we go back and add a consistencycheck.
28
An example of a sample questionnaire
29
Note the following about the sample questionnaire:
Each questionnaire corresponds to a household. Each questionnaire (household) has a unique four-digit
number at the top. We collect age,sex,and marital status for up to ten people in
the household. We collect type of housing and roof for the household. Continue to the next step.
30
31
Step 2:Start CSPro
First,create a new folder for all files you will use in thistutorial.
Open Windows Explorer
Create a folder named "c:\CSProTutorial".
Now you are ready to start CSPro:
Double-click on your desktop’s CSPro 4.1 icon.
or
Highlight the Programs line
Highlight CSPro 4.1 next to Programs
Highlight and click CSPro 4.1 next to CSPro 4.1
The following CSPro main screen will appear.
32
Continue to the next step
33
Step 3:UseWizard for NewApplication
We will create a data entry application.This contains:
Data dictionary: The data dictionary describes theorganization of the data file.It holds information about all thequestions and responses on the questionnaire.
Forms:The forms will appear on the screen when you runthe data entry application.They contain data entry fields,text,and lines.
Logic (optional):You can use the CSPro language to controlthe flow of your program, to write logic to check for errorsduring data entry,to access lookup files,and many otherthings.We will not use logic untilTask 6.
We will use theWizard to create the files that the data entryapplication requires.
Click on the radio button that says Create a newapplication.You should see the following dialog box.
34 Select Data EntryApplication and Press OK.
In the file open dialog box:
Enter "MyEntry" as the file name for the application.
Make sure you are located in the folder you created for theseexercises (‘c:\CSProTutorial’).
Press Create.The following screen is displayed
35
The next screen will ask you select the Input Dictionary.
Change the name to "c:\CSProTutorial\MyDict.dcf".
Press OK.
You have created a new data entry application
This completes thisTask.Continue to the nextTask (Task 2).
37
2. Create the Data Dictionary
Step 1:The ID Item
We will make our dictionary first,then our forms.
CSPro automatically generates a skeleton data dictionary.We will
change it and add our own information.
Every data dictionary requires at least one Id item—you willoften have more than one.An ID (identification) item is aunique number (or series of numbers) that allowsCSPro to distinguish between individual questionnaires.
CSPro requires at least one ID item.
Click on (Id Items), then on the‘+’next to it to openthe tree on the left side of the screen.You will see thatCSPro has created one id item.
On the right side of the screen you will see in the Len columnthat this item has the length of one character.We willmake this four (4) characters.
Right-click on‘MyDict identification",below (Id Items) onthe tree,then select Modify Item.
Press the Enter key three times until the length is highlightedin blue.
Type "4",then Enter,then click on the white space belowthis line to finish making this change.
When you have completed this step the screen should looksomething like:38
39
Continue to the next step.
Step 2:The RecordsA record usually corresponds to a section of a questionnaire,
and consistsof a group of related questions.By default,CSPro creates one record.Our tutorial
application(Sample questionnaire) will have two records,a‘Person Record’and a‘HousingRecord’.We will changethe one record that CSPro generated to‘Person Record’,then add the‘HousingRecord’.
First,we will change the one record that CSPro generated to‘Person Record’:
40
Right-click on‘MyDict record’on the tree on the left,thenselect Modify Record.
Type "Person record" as the Record Label,then press Enter.
Type "PERSON_RECORD" as the Record Name,then pressEnter.
Press Enter to leave theType value as it is.
Press‘N’to change Required fromYes to No,thenpress Enter. Our application can have households withno people,so Person records are not required for us.
Our application can have up to 10 people in a household, sotype "10",then Enter,to change Max and complete thechanges to this record.
41
42
Next we will add the‘Housing Record’:
Right-click on Person Record on the tree on the left,thenselect Add Record.
Type "Housing Record" as the Record Label,the press Enter.
Press Enter to accept‘HOUSING_RECORD’ as the RecordName.
Press Enter to leave the Type value as it is.
Press Enter to leave RequiredYes.
Press Enter to leave Max 1 and start a new record.
Press Esc on the blank record to finish making these changes.
When you have completed this step the screen should looksomething like:
43
Continueto the next step.
44
Step 3:Create the Items
First,we will create the items‘Age’,‘Sex’,and‘MaritalStatus’in the Person record.
Right-clickon‘Person Record’on the tree,then selectAdd Item.
Enter "Age" as the Item Label,then press Enter. Press Enter to acceptAGE as the Item Name. Press Enter to accept the Start position. Type "2" then Enter to indicatethatAge takes up two
characters.This is because in our applicationwe havechosen to enter ages only up to 99.
Press Enter six times to accept the rest of the defaultattributes forAge.
Enter the attributes for the Sex item.After you type inthe label and name,you can keep pressing Enter toaccept all the other default attributes.
Enter the attributes for the Marital status item.After youtype in the label and name,you can keep pressing Enterto accept all the other default attributes.
Press Esc to finish creating the items.
45
somethinglike:46
Next,we will create the‘Type household’and‘Type roof’items in the Housingrecord.
Right-clickon‘HousingRecord’,then select Add Item. Enter the attributes for the‘Type Household’item.After
you type in the label and name,you can keep pressingEnter to accept all the other default attributes.
Enter the attributes for the‘Type Roof’item.After youtype in the label and name,you can keep pressing Enterto accept all the other default attributes.
Press Esc to finish creating the items.
When you have completed this step the screen should look
47
Continueto the next step.
Step 4:CreateValues for the ItemsValue sets define what data values we expect for a data
item.Value sets are used to define ranges of valid valuesduringdata entry and to define categories for crosstabulation.
First,we will create a value set for‘Age’.We will use tenyear age groups.
Click on the ‘+’next to‘Person record’to makesure its items are showingon the tree.
Right-clickon‘Age’,then select AddValue Set.
48
Continuein this fashion until you have reached 90-99.49
Press EnterTwice to accept the default Value Set LabelandValue Set Name.
The cursor will drop to the line below into the ValueLabelcolumn.
Type "0 to 9" for the Value Label,then Enter. Type "0" as the From value,then Enter. Type "9" as the To value,then Enter twice,
skippingover the Special column. Type "10 to 19" for the next Value Label,then Enter. Type "10" as the From value,then Enter. Type "19" as the To value,then Enter twice,
skippingover the Special column.
Next,we will create a value set for‘Sex’.
Right-click on‘Sex’,then select AddValue Set.
Press Enter twice to accept the default Value Set LabelandValue Set Name.
The cursor will drop to the line below into the Value Labelcolumn.
Type "Male" as the first Value Label.
Type "1" as the From value.
Press Enter twice to skip over the To and Specialcolumns
50
Type "Female" as the second Value Label.
Type‘"2" as the From value.
Press Enter twice to skip over the To and Specialcolumns
Press Esc to finish creating the value set.
To finish up:
Add a value set for‘Marital Status’.Use‘1’for Married and‘2’for Not married.
Add values for the‘Housing Record’ items from the housinginformation in the questionnaire.
51
VERY IMPORTANT: Now save the work you have done so far.Select File/Save from the main menu,or click on thetoolbar.
When you completed this step,the screen might look somethinglike:
52
This completes theTask 2.Continue to the nextTask (Task 3).
53
3. Create the Data Entry Forms
Step 1:Place ID and Housing Items on Form
We will now switch from the data dictionaryto the forms.IMPORTANTNOTE:Generally it is a good idea to make the data entry forms
look just like the questionnaireitself.We can easily dothis in CSPro.However,in order to show you morefeatures and save time,we will not do so (use the help foryour application on this).
We will place the dictionaryitems on the data entry form.
Click on the toolbar.A blank gray form will appear on
the right hand side of the screen.
Make sure the items on the tree are expanded so you can seethem all.If any item has a ‘+’sign next to it,click on the‘+’sign.
Drag and drop‘MyDict identification" from the tree to thetop of the form. (Click on‘MyDict identification’and holdthe mouse button down while you move the mouse to thetop of the form,then release the mouse button.)
Drag and drop‘Housing Record" from the tree to the form,underneath ID_ITEM.
Click OK to accept the Drag Options settings.
54
55
Next,we will line things up. Multi-select the three pieces of text.Hold down the Ctrl
key and click on‘Id Item’,then click on‘Typehousehold’,click on‘Type roof’,then release the Ctrlkey.
Select Align/Leftfrom the main menu. Multi-select the three data entry boxes. Select Align/Left.
When you have completed this step the screen should looksomethinglike:
56
Continueto the next step.
57
Step 2:AddText and BoxesFirst,we will add our own line of text at the top of the
screen. Right-clickon the form,somewhere above‘Id Item’. Select AddText from the menu. Type "My FirstApplication",then Enter (or click on
OK). Adjustthe positionof the text until it is just where you
want it.To do this,select the text (click on it) and usethe arrow keys,or drag and drop the text to the newlocation.
58
Next we will draw a box around the data entry fields. Click on the toolbar.A small toolbar will appear
floatingover the screen. Click on the box second to the right of the floating
toolbar.Positionthe mouse pointer above and to the left of‘Id
item’. Left-click and hold the button down. Drag the mouse toward the right and down. When the box looks the way you want it,release the
mouse button.
Click again on the main toolbar to close thefloatingtoolbar.
When you have completed this step the screen should looksomethinglike:
59
Continueto the next step
60
Step 3:Generate FormsAutomatically
CSProallows you to generate a complete set of forms,which include all the items in the data dictionary,in oneoperation.We will use this feature now in order to savetime.
Select Edit/GenerateForms from the main menu,or press Ctrl-G.
CSProwill warn you that the forms you made in steps 1and 2 will be replaced.
Click on Yes to continue.
The Drag Options dialog box will appear.Makesure the Roster Options has Horizontal selected.Click on OK to close the Drag Options dialogbox.
Note that the tree on the left shows that you now havethree forms.Open up the entire tree by clicking the ‘+’next to any part of the tree.
Click on PERSON_RECORD_FORMon the tree.You will see the roster that CSPro created for you.
Click around on the tree on the left as you like toexplore the forms that CSPro created.
61
VERY IMPORTANT:Now save the work you have done so far.Select File/Save
from the main menu,or click on the toolbar.When you have completed this step the screen should look
somethinglike:
62
This completes theTask 3.Continue to the nextTask (Task 4).
63
4. Enter Data
Step 1:Run the Data EntryApplication
Your data entry applicationis now ready to run! CSEntry isthe name of the program that runs this application,allowingyou to key in data.
Run CSEntry by clicking on the toolbar,orpressingCtrl-R.(CSProwill ask you to save your work ifyou haven’t already done so.ClickYes.)
CSEntrywill ask you to select a data file.The data we keywill go into this file.
64
Change to the folder you created for this set of exercises,"c:\CSProTutorial".Type "MyData.dat"for the file name,then press Enter.
CSEntrywill ask if you want to create a new file.ClickYes.
CSEntrywill ask for your Operator ID.You may typein anythingyou like.
The first data entry form will appear with the cursorready for you to begin entering data.
When you have completed this step the screen should looksomethinglike:
65
Continueto next step.
66
Step 2:Begin toAdd a Case
We will now type in the data for our first case(questionnaire).We will use a fictitiousfamily of four.
Type "1" then Enter to fill in the id item.The next formwill appear,showingthe person roster.
Type“18" in the‘Age’field.The cursor will moveto the‘Sex’field.
Type "3" in the‘Sex’field.CSEntrywill tell you thisvalue is out of range,because it is not in the value set for‘Sex’you created in your data dictionary.
67
With the OUT OF RANGE messagestill showing,type "1".The message will go away and the cursorwill move to the‘Marital Status’field.
Continuetyping in data for the family as shown below.Tips: You can move backward to the previous field usingShift-
Tab,left arrow or up arrow. You can move forward to the next field using Enter,Tab,
right arrow or down arrow. You can change a field by simplytyping a new number
into it. You can erase a field using the space bar.
68
Continueto next step.
Step 3:FinishAdding a CaseWe will now tell the roster that we have finished entering
people. Hold down the Ctrl key. Press the slash key (‘/’’) on the numeric keypad.
The next form will appear on the screen.If you have trouble finding this key combination,whichcould be the case on some laptops,you can selectNavigation/End Groupfrom the main menu.
69
70
Next we will type in the household form and end the case. Type "1" in the‘Type Household’field. Type "1" in the‘Type Roof’field. CSEntrywill ask us to accept the case.At this point you
can select No and go back and make changes to the datain the case if you like.If you are satisfiedthat the data arecorrect,press Enter or select Yes.
CSEntrywill now show the first form again (NEWSECOND EMPTY QUESTIONNAIRE),with the cursorready for you to type in another case.We will now stopaddingcases.
Click the on the toolbar,or press Esc or Ctrl-S,orselect Mode/Stop from the main menu.
When you have completed this step the screen shouldlook somethinglike:
71
Continue to next step.
72
Step 4:Modify a CaseNowwe realize that the first person in the household is
really 15 years old and not 18 as we typed in.We will goback into the data and change this value.
Click on on the toolbar,or press Ctrl-M to enterModify mode.You should see the first form,with thevalue‘1’showingfor‘Id item’.
Press the PgDn key to advance to the next form. Type“15" in the‘Age’field. Press F12 to indicatethat you have finished making your
changes.
The screen will now look something like the picturebelow.CSEntry will ask you to accept the case,like it didin the previous step.Select Yes.
CSEntrywill save your changes and exit from Modifymode.
Close CSEntryby clicking on the X in the top rightcorner,or selecting File/Exit from the main menu.
This completes thisTask 4.Continue to nextTask (Task 5).
73
Wizard,as we did inTask 2.74
5. Tabulate Data
Step 1:Create aTabulationApplication
In this exercise we will perform simple cross tabulationsofthe data you entered in the previousTask.If you still have your data entry applicationopen frompreviousTask,close it now.
Select File/Close from the main menu.CSPro mayprompt you to save changes.SelectYes.
We will now create a cross tabulation applicationusing the
Select File/New from the main menu,or clickon the toolbar
75
Select TabulationApplication. Press OK.
76
In the file open dialog box: Enter "MyTab" as the file name for the application. Make sure you are located in the folder you created for
these exercises (‘c:\CSProTutorial’). Press Create.The next screen will ask you select the Input Dictionary. Change the name to "c:\CSProTutorial\MyDict.dcf". Press OK.You are now ready to begin designingyour tabulation.When you have completed this step the screen should look
somethinglike:
77
Continueto next step.
78
Step 2:Select Items toTabulate
We will create a tabulationofAge by Sex.Age will appearas the rows and Sex as the columns.
Click on the ‘+’next to‘Person record’to makesure its items are showingon the tree.
Drag and drop‘Age’from the tree to the left side of thetable.(Click on‘Age’and hold the mouse button downwhile you move the mouse to the side of the table thenrelease the mouse button.)The drop point should be inthe white space next to one of the gray boxes along theside.
item.79
Drag and drop‘Sex’from the tree to the top of the table.(Click on‘Sex’and hold the mouse button down whileyou move the mouse to the top of the table then releasethe mouse button.)The drop point should be in thewhite space just under one of the gray boxes along thetop.
Tips: The item you drag from the dictionarytree will become
either a row item or a column item depending on whereyou drop it.Imagine a diagonalline from the top left tothe bottom right of the table.An item dropped on theleft/under that line becomes a row item.An itemdropped on the right/abovethat line becomes a column
You can remove an item from the table by clicking onany of its associatedlabels then dragging and droppingitback to the dictionarytree,or by right-clickingon any ofits labels and selecting‘Delete’.
When you have completed this step the screen should looksomethinglike:
80
Continueto next step.
81
Step 3:Run theTabulationWe are now ready to run the tabulation.We will use the data
file you created in the previousTask. Run the tabulation by clicking on the toolbar,or
pressingCtrl-R.If CSPro prompts you to save the changes,click on Yes.
CSProwill ask you for the data file(s) to tabulate.Select‘MyData.dat’.Make sure the dialog box is set to the folderyou created for theseTasks,“C:\CSProTutorial".
The tabulated numbers will now appear in the table.That’sall there is to it!Then you have completed this step thescreen should look something like:
82
This completes thisTask 5.Continue to nextTask (Task 6).
83
6. Modify theTable
Step 1:Add Percents
In thisTask we will modify the table you created in thepreviousTask.We will begin by adding percents tothe columns next to the values for the Sex variable.
Right-clickon the word "Sex" on the table,just abovethe word "Male".
Select TallyAttributes (Sex) from the right-clickmenu.
In the list on the left of the dialog box markedAvailable,click on Percents and then click theAdd-->button.You should now see Percents listed in the list on right ofthe dialog box marked Selected.
84
Click OK.You should see three new columns on thetable for the percents.
Run the tabulation by clicking on the toolbar,orpressingCtrl-R.
When CSPro prompts you to save the changes,click onYes.
Select‘MyData.dat’as the data file to tabulate,as in thepreviousTask.
85 Continue to next step.
86
Step 2:Add a Universe
We will now add a Universe to our table.AUniverse is a "filter", or a way of restricting thetable to a subset of the data records that meet acertain condition. In this step we will run thetable for married people.
Right-click anywhere on the table. Select TallyAttributes (Table) from theright-click menu.
In the section of the dialog box marked Universe,type"marital_status= 1".
IMPORTANTNOTE:Be sure to type this correctly.Otherwise,you may see the
message "Invalid Universe Syntax".
Click OK.87
Run the tabulation by clicking on the toolbar,or
pressingCtrl-R.WhenCSPro prompts you to save the changes,click on Yes. Select‘MyData.dat’as the data file to tabulate,as before.When you have completed this step you should see a table that
looks something like the following.Notice that the counts arelower than in the previous step because we are not countingunmarried people.
Continueto next step.
88
89
Step 3:Change theTitle FontCSPro gives you great control over the format of
your tables.As an example,in this step we willchange the font of our table’s title to make itbigger.
Right-click on the title "Table 1.Age by Sex" atthe top of the table.
Select Format (Title) from the right-clickmenu.
In the section of the dialog box marked Fontand Color click on the Change button.
This completes thisTask 6.Continue to nextTask (Task 7).90
In the Fontdialogboxthatappears,changetheSize from12 to 16.
Click OK to close the Font dialog box.
Click OK to close the Format (Title) dialog box. When you have completed this step you should see that the
title is now larger.
9
7. Add Edits to the Data EntryStep 1:Write Logic for the Edit
We will now return to the data entry application.We will introduce a check to make sure thatmarried people are at least 12 years old.In ourdata entry application, we will perform this checkimmediately after the keyer enters the maritalstatus.
• If you still have your cross tabulation applicationopen from previous exercises,close it now.
92
Select File/Close from the main menu.CSPro mayprompt you to save changes.Select Yes.
Open the data entry application we created earlier.SelectFile/Openfrom the main menu.Click on theapplicationname,MYENTRY.ENT,and click on open.
Get ready to write logic by pressingCtrl-L or selectingView/ViewLogic from the main menu.
Press Ctrl+T to show names instead of labels in theforms tree.
Click on the ‘+’next to‘PERSON_RECORD_FORM’then click on the‘+’next to ‘PERSON_RECORD000then click on‘MARITAL_STATUS’.
The frame on the right hand side of the screen should show‘PROC MARITAL_STATUS’at the top.
Note that‘PROC’is short for procedure.We put ourlogic in the procedure for‘MARITAL_STATUS’becausewe want it to execute immediately after the operatorkeys this field.
Type in logic exactly as you see below.
93
94
Step 2:Compile the LogicYou have typed logic in the CSPro language. Like
all procedural languages,the system must checkto make sure there are no syntax errors.This iscalled compiling.
Click on MYDICT_FF in the forms tree to showall the CSPro logic.
Compile the logic by clicking on thetoolbar,or pressing Ctrl+K or selectingFile/Compile from the main menu.
95
If you typed the logic correctly,you will see CompileSuccessfulin the Compiler Output under the logic.
If you see a dialog box that says Compile Failed,youhavetyped something incorrectly.A red circle willappear in the margin indicatingthe approximatelocationof the error.The Compiler Output tab at thebottom of the screen will show you an error messageto help you determine the error.Check very carefully tomake sure you typed in exactly what was shown in thepreviousstep.
When you have completed this step the screen should looksomethinglike:
96
Continueto next step.
97
Step 3:Test the EditWe are now ready to run the data application and
make sure our logic is working properly. Run CSEntry by clicking on the toolbar,or
pressing Ctrl-R. CSPro will ask you to save the changes.
Click Yes. CSEntry will ask you to select a data file.Type
"MyData.dat" for the file name,if it is not alreadythere,then press Enter.
Type in any Operator ID.
Click on on the toolbar,or press Ctrl-A to enterAddmode.The first form will appear with the cursor on‘IdItem’.
Type "2" then Enter to fill in the id item.The next formwill appear,showingthe person roster.
Type "10" in the‘Age’field. Type "1" in the‘Sex’field. Type "1" in the‘Marital Status’field. Your error message should appear on the screen,as
shownbelow.
98
99
Continueto next step.
100
Step 4:Complete the CaseWe will finish entering data for the second case,
including the error condition,so that we will beable to test that condition in the following exercise. Press F8 to clear the message. Hold down the Ctrl key and press the slash key
(‘/’’) on the numeric keypad.The next form willappear on the screen.
Type "1" in the‘Type Household’field. Type "1" in the‘Type Roof’field. CSEntry will ask us to accept the case. Select Yes.
Click the on the toolbar,or press Esc or Ctrl-S,or
select Mode/Stop from the main menu. • Close CSEntry by clicking on the X in the top right
corner,or selecting File/Close from the main menu. This completes thisTask7.
101
Useful Links U.S.Census Bureau website
http://www.census.gov/ipc/www/cspro
CSPro Usershttp://www.csprousers.org
Twitterhttp://twitter.com/cspro
Mailing list for CSPro [email protected]
Thank youfor
Your Kind attention
102