<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CSPro Users</title>
	<atom:link href="http://www.csprousers.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.csprousers.org</link>
	<description></description>
	<lastBuildDate>Sat, 05 May 2012 00:16:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Tools for Edit Processing</title>
		<link>http://www.csprousers.org/2012/04/18/tools-for-edit-processing/</link>
		<comments>http://www.csprousers.org/2012/04/18/tools-for-edit-processing/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 16:55:05 +0000</pubDate>
		<dc:creator>Gregory Martin</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.csprousers.org/?p=167</guid>
		<description><![CDATA[Recently I put up two new tools that may be useful to people using CSPro to edit data. The first tool, Listing File Comparer, provides a way of quickly looking at the error percentages across a group of listing files. This is useful for people who process data, typically census data, on files split by <a href='http://www.csprousers.org/2012/04/18/tools-for-edit-processing/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Recently I put up <a href="http://www.csprousers.org/tools/" title="http://www.csprousers.org/tools/">two new tools</a> that may be useful to people using CSPro to edit data.</p>
<p>The first tool, <strong>Listing File Comparer</strong>, provides a way of quickly looking at the error percentages across a group of listing files. This is useful for people who process data, typically census data, on files split by geography.</p>
<p>The second tool, <strong>Save Array Viewer</strong>, is a program that visually displays the contents of save array files. This program is especially useful if you use DeckArrays for hotdeck imputation.</p>
<p>Also newly posted on the site is a tutorial about creating CAPI applications written by Anne Abelsæth of Statistics Norway: &#8220;<a href="http://www.ssb.no/english/subjects/00/90/doc_201219_en/doc_201219_en.pdf" title="http://www.ssb.no/english/subjects/00/90/doc_201219_en/doc_201219_en.pdf">Development of Data Entry and CAPI Applications in CSPro</a>&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csprousers.org/2012/04/18/tools-for-edit-processing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Keeping Track of Entered Cases</title>
		<link>http://www.csprousers.org/2012/02/22/keeping-track-of-entered-cases/</link>
		<comments>http://www.csprousers.org/2012/02/22/keeping-track-of-entered-cases/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 20:47:51 +0000</pubDate>
		<dc:creator>Gregory Martin</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.csprousers.org/?p=149</guid>
		<description><![CDATA[Unfortunately, CSPro does not have a way, within a data entry application, to get a listing of the IDs of the other cases that have been entered to the primary data file. If your application is somewhat simple, you can write a two-dictionary application to facilitate a basic version of case management. In this example, <a href='http://www.csprousers.org/2012/02/22/keeping-track-of-entered-cases/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Unfortunately, CSPro does not have a way, within a data entry application, to get a listing of the IDs of the other cases that have been entered to the primary data file. If your application is somewhat simple, you can write a two-dictionary application to facilitate a basic version of case management.</p>
<p>In this example, the main dictionary of the application is a junk dictionary. Any data entered to this dictionary will be ignored. We only use this dictionary to provide the framework for the main data entry application and as a way to enter a menu selection.</p>
<p>The external dictionary and form is actually where data is entered for this application. By using loadcase and writecase statements, it is possible to add and modify cases.</p>
<p>Whenever the data entry application is started, an array is populated with information about all of the cases in the data file. In this example, the program is hardcoded to expect that information about households 1-8 will eventually be added to the file. The program reports on what has been entered and what cases are remaining.</p>
<p><img src="http://www.csprousers.org/wp-content/uploads/2012/02/20120222menu.png" alt="" title="20120222menu" width="439" height="257" class="aligncenter size-full wp-image-150" /></p>
<p>This list is created by using the find statement to check on all of the expected IDs in the external file (which really is the main data file for this application). Then the setvalueset and setcapturetype functions display the results on the screen.</p>
<p><a href='http://www.csprousers.org/wp-content/uploads/2012/02/externalDictionaryAsMainDictionary.zip'>Download the example here, or view the code below.</a></p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>PROC</font> <font color='blue'>GLOBAL</font></p>
<p><font color='blue'>array</font> <font color='blue'>numeric</font> casesIDs(<font color='red'>100</font>);<br /><font color='blue'>array</font> <font color='blue'>alpha</font> (<font color='red'>30</font>) casesLabels(<font color='red'>100</font>);</p>
<p><font color='blue'>numeric</font> numberCasesExpected = <font color='red'>8</font>; <font color='green'>//&nbsp;eight cases expected for the cluster<br /></font></p>
<p><font color='blue'>PROC</font> MENU_FF</p>
<p><font color='blue'>PROC</font> MENU_ID</p>
<p><font color='blue'>onfocus</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;MENU_ID = <font color='blue'>notappl</font>; <font color='green'>//&nbsp;reset any value that might be here<br /></font><br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>numeric</font> cnt,numLabels,someCasesNotEntered;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>do</font> cnt = <font color='red'>1</font> <font color='blue'>while</font> cnt &lt;= numberCasesExpected<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HHID = cnt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;casesIDs(numLabels) = HHID;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>if</font> <font color='blue'>find</font>(QUESTIONNAIRE_DICT,=,<font color='blue'>itemlist</font>(HHID)) <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;casesLabels(numLabels) = <font color='blue'>maketext</font>(<font color='fuchsia'>&quot;Modify Household %d&quot;</font>,cnt);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>else</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;casesLabels(numLabels) = <font color='blue'>maketext</font>(<font color='fuchsia'>&quot;Add Household %d&quot;</font>,cnt);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;someCasesNotEntered = <font color='red'>1</font>;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>endif</font>;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>inc</font>(numLabels);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>enddo</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;casesIDs(numLabels) = <font color='red'>99</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;casesLabels(numLabels) = <font color='fuchsia'>&quot;Quit&quot;</font>;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>inc</font>(numLabels);<br />&nbsp;&nbsp;&nbsp;&nbsp;casesIDs(numLabels) = <font color='blue'>notappl</font>; <font color='green'>//&nbsp;end the dynamic value set<br /></font>&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>setvalueset</font>(MENU_ID,casesIDs,casesLabels);<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>setcapturetype</font>(MENU_ID,<font color='red'>1</font>);</p>
<p><font color='blue'>postproc</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>if</font> MENU_ID = <font color='red'>99</font> <font color='blue'>then</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>if</font> someCasesNotEntered <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>if</font> ( <font color='blue'>errmsg</font>(<font color='fuchsia'>&quot;You are not finished entering cases. Are you sure you want to quit?&quot;</font>) <font color='blue'>select</font>(<font color='fuchsia'>&quot;Yes&quot;</font>,continue,<font color='fuchsia'>&quot;No&quot;</font>,continue) ) = <font color='red'>2</font> <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>reenter</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>endif</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>endif</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>stop</font>(<font color='red'>1</font>);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>endif</font>;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;HHID = MENU_ID;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>if</font> <font color='blue'>not</font> <font color='blue'>loadcase</font>(QUESTIONNAIRE_DICT,HHID) <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>clear</font>(QUESTIONNAIRE_DICT); <font color='green'>//&nbsp;we are adding a new case so we must make sure the fields are blank<br /></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HHID = MENU_ID;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>endif</font>;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>enter</font> QUESTIONNAIRE_FF;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>writecase</font>(QUESTIONNAIRE_DICT); <font color='green'>//&nbsp;write the case to the data file<br /></font><br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>reenter</font>;<br /></font></div>
]]></content:encoded>
			<wfw:commentRss>http://www.csprousers.org/2012/02/22/keeping-track-of-entered-cases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting Check Boxes Into Single Variables</title>
		<link>http://www.csprousers.org/2012/02/13/converting-check-boxes-into-single-variables/</link>
		<comments>http://www.csprousers.org/2012/02/13/converting-check-boxes-into-single-variables/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 19:56:52 +0000</pubDate>
		<dc:creator>Sebastien Thierry</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.csprousers.org/?p=140</guid>
		<description><![CDATA[Using checkboxes for categorical variables is a common way for censuses and surveys to quickly get data onto a paper form and scanned into a data file. Enumerators do not have to translate responses into numbers, and scanners can more easily recognize checked boxes than handwritten characters. These checkboxes need to be converted into single <a href='http://www.csprousers.org/2012/02/13/converting-check-boxes-into-single-variables/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Using checkboxes for categorical variables is a common way for censuses and surveys to quickly get data onto a paper form and scanned into a data file. Enumerators do not have to translate responses into numbers, and scanners can more easily recognize checked boxes than handwritten characters. These checkboxes need to be converted into single variables with single responses. But what do you do when there is more than one checked box, either due to enumerators not understanding how to complete the question or due to scanners reading stray marks as checked boxes?</p>
<p>When converting checkbox variables into a single variable, there are two basic methods for correcting multiple checks: hotdeck between two marked boxes or determine an order of likelihood. If three or more boxes are marked, the edits become more complicated and, due to the small probability of such occurrences, one can either write complicated edits or the converted variable can be set to blank and edited later using more detailed content edits.</p>
<p>Before converting multiple checkbox variables into a single variable, one must first check the number of boxes marked. This can be done by counting the number of individual checkbox variables. Then the conversion coding will be done based on the number of checked boxes. If only one box is checked, the new variable can easily be created without any special methods to determine the value.</p>
<p>Assuming that the checkbox variables have a value of 1 if checked and 0 if not checked, one can count the number of marked boxes like so:</p>
<div style='margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt'><font color='black'><font color='blue'>numeric</font> numChecks = DWELLING_TYPE_SCAN1 + DWELLING_TYPE_SCAN2 + DWELLING_TYPE_SCAN3;</font></div>
<p><strong>Using a Hotdeck</strong></p>
<p>Hotdecking is a simple way to estimate the value of a variable based on the checked boxes and on related variables. In the example below, in cases when two boxes are checked, the selection of which of the two values will be used for the new variable is determined from the roofing material. The hotdeck array has two dimensions: the first for each combination of the two checked boxes, and the other for the roofing material. When there are no checked boxes, then the new variable is left blank, to be handled by later edits. When one box is checked, the new variable is coded according to the checked box and the hotdeck is updated based on each combination of two checked boxes and on the roofing material. If two boxes are checked, then the new variable is coded based on the hotdeck using the given combination of checked boxes and the roof type.</p>
<p>Question: Type of Dwelling?<br />
Answers: Separate, Apartment, Joint/Barrack House<br />
Conversion Method: Hotdeck based on roofing material</p>
<div style='margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt'><font color='black'><font color='blue'>numeric</font> dwellTypeHD12 = <font color='red'>1</font>,dwellTypeHD13 = <font color='red'>2</font>,dwellTypeHD23 = <font color='red'>3</font>;</p>
<p><font color='blue'>numeric</font> roofMaterial;</p>
<p><font color='blue'>if</font> ROOF_MATERIAL_SCAN1 <font color='blue'>then</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;roofMaterial = <font color='red'>1</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> ROOF_MATERIAL_SCAN2 <font color='blue'>then</font>&nbsp;roofMaterial = <font color='red'>2</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> ROOF_MATERIAL_SCAN3 <font color='blue'>then</font>&nbsp;roofMaterial = <font color='red'>3</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> ROOF_MATERIAL_SCAN4 <font color='blue'>then</font>&nbsp;roofMaterial = <font color='red'>4</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>else</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;roofMaterial = <font color='red'>5</font>;<br /><font color='blue'>endif</font>;</p>
<p><font color='blue'>if</font> numChecks = <font color='red'>0</font> <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='green'>//&nbsp;leave DWELLING_TYPE blank, to be edited later during the content edits<br /></font>&nbsp;&nbsp;&nbsp;&nbsp;<br /><font color='blue'>elseif</font> numChecks = <font color='red'>1</font> <font color='blue'>then</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>if</font> DWELLING_TYPE_SCAN1 <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWELLING_TYPE = <font color='red'>1</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwellTypeHD(dwellTypeHD12,roofMaterial) = <font color='red'>1</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwellTypeHD(dwellTypeHD13,roofMaterial) = <font color='red'>1</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> DWELLING_TYPE_SCAN2 <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWELLING_TYPE = <font color='red'>2</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwellTypeHD(dwellTypeHD12,roofMaterial) = <font color='red'>2</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwellTypeHD(dwellTypeHD23,roofMaterial) = <font color='red'>2</font>;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> DWELLING_TYPE_SCAN3 <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWELLING_TYPE = <font color='red'>3</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwellTypeHD(dwellTypeHD13,roofMaterial) = <font color='red'>3</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwellTypeHD(dwellTypeHD23,roofMaterial) = <font color='red'>3</font>;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>endif</font>;</p>
<p><font color='blue'>elseif</font> numChecks = <font color='red'>2</font> <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>if</font> DWELLING_TYPE_SCAN1 <font color='blue'>and</font> DWELLING_TYPE_SCAN2 <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWELLING_TYPE = dwellTypeHD(dwellTypeHD12,roofMaterial);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> DWELLING_TYPE_SCAN1 <font color='blue'>and</font> DWELLING_TYPE_SCAN3 <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWELLING_TYPE = dwellTypeHD(dwellTypeHD13,roofMaterial);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> DWELLING_TYPE_SCAN2 <font color='blue'>and</font> DWELLING_TYPE_SCAN3 <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWELLING_TYPE = dwellTypeHD(dwellTypeHD23,roofMaterial);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>endif</font>;</p>
<p><font color='blue'>elseif</font> numChecks &gt; <font color='red'>2</font> <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='green'>//&nbsp;leave DWELLING_TYPE blank, to be edited later during the content edits<br /></font><br /><font color='blue'>endif</font>;</font></div>
<p><strong>Order of Likelihood</strong></p>
<p>In a series of responses, it may be decided that certain responses are more likely than others. When multiple boxes are checked, the predetermined more likely response will be recoded as the actual response. In the example below, enumerators may mistakenly select more than one source of drinking water if the household has more than one source.  However, the enumerators were instructed to select only the most &#8220;modern&#8221; water source, so the responses were prioritized in the order that they appear, with the exception of tubewell. Thus, if tubewell and any other response were selected, the new variable is set to tubewell, and this recoding priority continues with tap, then well, and so on.</p>
<p>Question: Main Source of Drinking Water?<br />
Answers:  Tap, Tubewell/Deep Tubewell, Well, Pond, River/Ditch/Canal, Others<br />
Conversion Method:  Recode with priority (tubewell, tap, well, etc.)</p>
<div style='margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt'><font color='black'>numChecks =&nbsp;WATER_SOURCE_SCAN1 + WATER_SOURCE_SCAN2 + WATER_SOURCE_SCAN3 +<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WATER_SOURCE_SCAN4 + WATER_SOURCE_SCAN5 + WATER_SOURCE_SCAN6;<br />&nbsp;<br /><font color='blue'>if</font> numChecks = <font color='red'>0</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='green'>//&nbsp;leave DWELLING_TYPE blank, to be edited later during the content edits<br /></font><br /><font color='blue'>elseif</font> numChecks = <font color='red'>1</font> <font color='blue'>then</font><br />&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>if</font> WATER_SOURCE_SCAN1 <font color='blue'>then</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WATER_SOURCE = <font color='red'>1</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> WATER_SOURCE_SCAN2 <font color='blue'>then</font> &nbsp;WATER_SOURCE = <font color='red'>2</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> WATER_SOURCE_SCAN3 <font color='blue'>then</font> &nbsp;WATER_SOURCE = <font color='red'>3</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> WATER_SOURCE_SCAN4 <font color='blue'>then</font> &nbsp;WATER_SOURCE = <font color='red'>4</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> WATER_SOURCE_SCAN5 <font color='blue'>then</font> &nbsp;WATER_SOURCE = <font color='red'>5</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> WATER_SOURCE_SCAN6 <font color='blue'>then</font> &nbsp;WATER_SOURCE = <font color='red'>6</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>endif</font>;<br />&nbsp;<br /><font color='blue'>elseif</font> numChecks &gt;= <font color='red'>2</font> <font color='blue'>then</font><br />&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>if</font> WATER_SOURCE_SCAN2 <font color='blue'>then</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WATER_SOURCE = <font color='red'>2</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> WATER_SOURCE_SCAN1 <font color='blue'>then</font> &nbsp;WATER_SOURCE = <font color='red'>1</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> WATER_SOURCE_SCAN3 <font color='blue'>then</font> &nbsp;WATER_SOURCE = <font color='red'>3</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> WATER_SOURCE_SCAN4 <font color='blue'>then</font> &nbsp;WATER_SOURCE = <font color='red'>4</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>elseif</font> WATER_SOURCE_SCAN5 <font color='blue'>then</font> &nbsp;WATER_SOURCE = <font color='red'>5</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='green'>//&nbsp;elseif WATER_SOURCE_SCAN6 &#046;&#046;&#046; not needed because it would have been handled in the numChecks = 1 case<br /></font>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>endif</font>;<br />&nbsp;<br /><font color='blue'>endif</font>;</font></div>
<p>If conversions like this are often being made, the code in the numChecks = 1 and numChecks = 2 sections can be combined in a reusable function.</p>
<div style='margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt'><font color='black'><font color='blue'>array</font> waterPriorities(<font color='red'>6</font>) = <font color='red'>2</font> <font color='red'>1</font> <font color='red'>3</font> <font color='red'>4</font> <font color='red'>5</font> <font color='red'>6</font>;</p>
<p><font color='blue'>function</font> assignValueFromCheckbox(<font color='blue'>array</font> priorities,<font color='blue'>alpha</font> (<font color='red'>20</font>) checks)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>numeric</font> cnt;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>do</font> cnt = <font color='red'>1</font> <font color='blue'>while</font> cnt &lt;= <font color='blue'>tblrow</font>(priorities)<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>if</font> checks[priorities(cnt):<font color='red'>1</font>] = <font color='fuchsia'>&quot;1&quot;</font> <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;assignValueFromCheckbox = priorities(cnt);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>exit</font>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>endif</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>enddo</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;assignValueFromCheckbox = <font color='blue'>notappl</font>; <font color='green'>//&nbsp;no checkbox was marked<br /></font><br /><font color='blue'>end</font>;</p>
<p>WATER_SOURCE = assignValueFromCheckbox(&nbsp;waterPriorities,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>maketext</font>(<font color='fuchsia'>&quot;%d%d%d%d%d%d&quot;</font>,WATER_SOURCE_SCAN1,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WATER_SOURCE_SCAN2,WATER_SOURCE_SCAN3,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WATER_SOURCE_SCAN4,WATER_SOURCE_SCAN5,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WATER_SOURCE_SCAN6));</font></div>
]]></content:encoded>
			<wfw:commentRss>http://www.csprousers.org/2012/02/13/converting-check-boxes-into-single-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things to Look Forward to in 2012</title>
		<link>http://www.csprousers.org/2011/12/30/2012-look-forward/</link>
		<comments>http://www.csprousers.org/2011/12/30/2012-look-forward/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 02:40:19 +0000</pubDate>
		<dc:creator>Gregory Martin</dc:creator>
				<category><![CDATA[Future Steps]]></category>

		<guid isPermaLink="false">http://www.csprousers.org/?p=124</guid>
		<description><![CDATA[As mentioned in my previous post, Unicode support (and thus internationalization) will be a great addition to CSPro, coming out in the next half year. After that, the development team plans to focus on the CAPI (computer assisted personal interviewing) world. CSPro currently supports a very basic version of CAPI, but only for Windows platforms. <a href='http://www.csprousers.org/2011/12/30/2012-look-forward/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>As mentioned in my previous post, Unicode support (and thus internationalization) will be a great addition to CSPro, coming out in the next half year. After that, the development team plans to focus on the CAPI (computer assisted personal interviewing) world. CSPro currently supports a very basic version of CAPI, but only for Windows platforms. With the proliferation of Android devices, as well as the upcoming Windows 8 tablets, CSPro must adapt to this new world of enumeration.</p>
<p>The world of small-scale surveys may not change dramatically, but the impact of technology on censuses is huge. This is a photo from an East African country that recently conducted a census. The warehouse in this photo stores all of the census forms and requires many workers to operate:</p>
<p><a href="http://www.csprousers.org/wp-content/uploads/2011/12/warehouse.jpg"><img src="http://www.csprousers.org/wp-content/uploads/2011/12/warehouse.jpg" alt="" title="warehouse" width="600" height="426" class="aligncenter size-full wp-image-125" /></a></p>
<p>What if an EA were not in the final set &#8230; how easy would it be to find in a mountain of forms? Imagine a world in which all data collection is conducted on a phone or a tablet and immediately sent to the operation headquarters. Data editing would be minimized and the time from collection to publication could effectively be cut to almost zero. Such a world will be an exciting one.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csprousers.org/2011/12/30/2012-look-forward/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Happy Holidays</title>
		<link>http://www.csprousers.org/2011/12/24/happy-holidays/</link>
		<comments>http://www.csprousers.org/2011/12/24/happy-holidays/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 20:22:59 +0000</pubDate>
		<dc:creator>Gregory Martin</dc:creator>
				<category><![CDATA[Administration]]></category>

		<guid isPermaLink="false">http://www.csprousers.org/?p=120</guid>
		<description><![CDATA[To all CSPro users around the world, the CSPro development team wishes you a happy holiday season. I have been fortunate this year to have had the chance to work on CSPro data processing with users in Armenia, Bangladesh, Cambodia, Kenya, and Paraguay. Add in the hundreds of users who have emailed with questions, and <a href='http://www.csprousers.org/2011/12/24/happy-holidays/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>To all CSPro users around the world, the CSPro development team wishes you a happy holiday season. I have been fortunate this year to have had the chance to work on CSPro data processing with users in Armenia, Bangladesh, Cambodia, Kenya, and Paraguay. Add in the hundreds of users who have emailed with questions, and CSPro users add up to a nice community. I hope that this website, and increased content next year, will help you fulfill your needs.</p>
<p>2012 should be a good year for CSPro, first with the addition of Unicode support, and then with steps towards the future of data entry, with focus on Android and other handheld development.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csprousers.org/2011/12/24/happy-holidays/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simplifying Batch Exports</title>
		<link>http://www.csprousers.org/2011/12/09/simplifying-batch-exports/</link>
		<comments>http://www.csprousers.org/2011/12/09/simplifying-batch-exports/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 23:28:30 +0000</pubDate>
		<dc:creator>Gregory Martin</dc:creator>
				<category><![CDATA[Version 4.1.002]]></category>

		<guid isPermaLink="false">http://www.csprousers.org/?p=98</guid>
		<description><![CDATA[When CSPro has an interface for a tool, I suggest that you use the interface as much as possible, but on occasion a user might want to write code for more advanced functionality. One such example is when writing code for advanced export operations. The CSPro help documents include some information on the export statement, <a href='http://www.csprousers.org/2011/12/09/simplifying-batch-exports/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>When CSPro has an interface for a tool, I suggest that you use the interface as much as possible, but on occasion a user might want to write code for more advanced functionality. One such example is when writing code for advanced export operations.</p>
<p>The CSPro help documents include some information on the <strong>export</strong> statement, but I often forget the syntax or what exactly the parameters should be. Fortunately, now with CSPro 4.1.002, a feature of the Export Data tool allows you to view the code that powers the export. By selecting Options -> Copy Logic to Clipboard, you can then take the export logic and insert it in the batch application of your choosing. This is a nice way to quickly get the basic export code needed and then you can build off of that.</p>
<p>For an example of a batch export that uses a lookup file, imagine that I have a data file describing stores and their customers. One of the attributes of a customer record is a country code that describes where the customer lives. When exporting the names of the customers, I do not want the two-letter country code, but the full name of the country. Using <a href="http://ftp.ics.uci.edu/pub/websoft/wwwstat/country-codes.txt">this list</a> of country codes as a lookup file, I would go into the export tool, select the fields that I want to export, and then after copying the logic to the clipboard I would see code like this:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>PROC</font> <font color='blue'>GLOBAL</font><br /><font color='blue'>SET</font> <font color='blue'>EXPLICIT</font>;</p>
<p><font color='blue'>NUMERIC</font> rec_occ;</p>
<p><font color='blue'>FILE</font> cspro_export_file_var_f;</p>
<p><font color='blue'>PROC</font> COUNTRYCODEEXPORT_QUEST<br /><font color='blue'>PreProc</font><br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>set</font> behavior() <font color='blue'>export</font> ( CommaDelim , ItemOnly );</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>For</font> rec_occ <font color='blue'>in</font> <font color='blue'>RECORD</font> CUSTOMER_REC <font color='blue'>do</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>EXPORT</font> <font color='blue'>TO</font> cspro_export_file_var_f<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>CASE_ID</font>(STORE_ID)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;STORE_REC, CUSTOMER_REC;<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>Enddo</font>;</font></div>
<p>I would insert this code into a new batch application, add my lookup file code, and I would end up with something like this:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>PROC</font> <font color='blue'>GLOBAL</font></p>
<p><font color='blue'>NUMERIC</font> rec_occ;</p>
<p><font color='blue'>FILE</font> cspro_export_file_var_f;</p>
<p><font color='blue'>PROC</font> COUNTRYCODEEXPORT_FF</p>
<p><font color='blue'>PROC</font> COUNTRYCODEEXPORT_QUEST</p>
<p><font color='blue'>PreProc</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>set</font> behavior() <font color='blue'>export</font> ( CommaDelim , ItemOnly );</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>For</font> rec_occ <font color='blue'>in</font> <font color='blue'>RECORD</font> CUSTOMER_REC <font color='blue'>do</font><br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='green'>//&nbsp;look up the country name<br /></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>if</font> <font color='blue'>not</font> <font color='blue'>loadcase</font>(COUNTRYCODES_DICT,CUSTOMER_COUNTRY) <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>errmsg</font>(<font color='fuchsia'>&quot;Could not find country code: %s&quot;</font>,CUSTOMER_COUNTRY);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FULL_NAME = <font color='fuchsia'>&quot;&lt;invalid&gt;&quot;</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>endif</font>;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>EXPORT</font> <font color='blue'>TO</font> cspro_export_file_var_f<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>CASE_ID</font>(STORE_ID)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;STORE_REC, CUSTOMER_REC FULL_NAME; <font color='green'>//&nbsp;FULL_NAME is added here (it comes from the lookup file)<br /></font>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>Enddo</font>;</font></div>
<p>This feature in the Export Data tool vastly simplified my task, allowing me to focus on the lookup file programming, rather than the syntax of the export statement. My exported file now contains data from two files:</p>
<p><font face="Courier New">500&nbsp;&nbsp;Pastry&nbsp;Pantry&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Barack&nbsp;Obama&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;US&nbsp;&nbsp;United&nbsp;States<br />
500&nbsp;&nbsp;Pastry&nbsp;Pantry&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Angela&nbsp;Merkel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DE&nbsp;&nbsp;Germany<br />
500&nbsp;&nbsp;Pastry&nbsp;Pantry&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hu&nbsp;Jintao&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CN&nbsp;&nbsp;China<br />
800&nbsp;&nbsp;Chocolate&nbsp;Heaven&nbsp;&nbsp;Jacob&nbsp;Zuma&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZA&nbsp;&nbsp;South&nbsp;Africa<br />
800&nbsp;&nbsp;Chocolate&nbsp;Heaven&nbsp;&nbsp;Alexander&nbsp;Lukashenko&nbsp;&nbsp;BY&nbsp;&nbsp;Belarus</font></p>
<p>This is the input file:</p>
<p><font face="Courier New">10500Pastry&nbsp;Pantry<br />
20500Barack&nbsp;Obama&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;US<br />
20500Angela&nbsp;Merkel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DE<br />
20500Hu&nbsp;Jintao&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CN<br />
10800Chocolate&nbsp;Heaven<br />
20800Jacob&nbsp;Zuma&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZA<br />
20800Alexander&nbsp;Lukashenko&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BY</font></p>
<p><a href='http://www.csprousers.org/wp-content/uploads/2011/12/20111209batchExport.zip'>Download this example</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csprousers.org/2011/12/09/simplifying-batch-exports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Data Entry Menus</title>
		<link>http://www.csprousers.org/2011/12/09/custom-data-entry-menus/</link>
		<comments>http://www.csprousers.org/2011/12/09/custom-data-entry-menus/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 22:44:47 +0000</pubDate>
		<dc:creator>Gregory Martin</dc:creator>
				<category><![CDATA[Version 4.1.002]]></category>

		<guid isPermaLink="false">http://www.csprousers.org/?p=93</guid>
		<description><![CDATA[In CSPro 4.1.002, you can customize the menus of the data entry application, CSEntry, to change the menu options to be in the language of your choice, as long as the language can be represented in ASCII characters (most European languages). In the future, when CSPro supports Unicode, all language scripts will be supported. To <a href='http://www.csprousers.org/2011/12/09/custom-data-entry-menus/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>In CSPro 4.1.002, you can customize the menus of the data entry application, CSEntry, to change the menu options to be in the language of your choice, as long as the language can be represented in ASCII characters (most European languages). In the future, when CSPro supports Unicode, all language scripts will be supported.</p>
<p>To override the default text options, you must create a file called <strong>csentry.menu</strong> and place it either in the Program Files\CSPro 4.1\ folder, or in the folder where the PFF file for your application is located. This file has a format that is easy to follow. For example, to override the File menu text, you would place this text in the file:</p>
<p><font face="Courier New">File=Fichier<br />
File_Open=Ouvrir une application<br />
File_OpenDat=Ouvrir un fichier de données<br />
File_Save=Sauvegarde partielle du questionnaire<br />
File_Exit=Fermer</font></p>
<p>To add shortcut keys, place an ampersand before the shortcut letter. For example:</p>
<p><font face="Courier New">File=&#038;Fichier<br />
File_Open=&#038;Ouvrir une application<br />
File_OpenDat=Ouvrir un fichier de &#038;données<br />
File_Save=&#038;Sauvegarde partielle du questionnaire<br />
File_Exit=&#038;Fermer</font></p>
<p><a href="http://www.csprousers.org/wp-content/uploads/2011/12/20111209menu.png"><img src="http://www.csprousers.org/wp-content/uploads/2011/12/20111209menu.png" alt="" title="20111209menu" width="306" height="185" class="aligncenter size-full wp-image-95" /></a></p>
<p>Placing the file in the Program Files\CSPro 4.1\ folder means that it will affect every single data entry application run on that machine. Alternatively, placing it in a folder with the PFF allows you to have different menus for different users.</p>
<p>Soon on this site I will post French and Spanish language menus on the <a href="/tools/">Tools</a> page. For now, if you would like to create your own menus, use this <a href="/downloads/tools/csentryMenus/csentry.menu">template file</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csprousers.org/2011/12/09/custom-data-entry-menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Functions: getusername, randomin, randomizevs</title>
		<link>http://www.csprousers.org/2011/12/09/new-functions-getusername-randomin-randomizevs/</link>
		<comments>http://www.csprousers.org/2011/12/09/new-functions-getusername-randomin-randomizevs/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 22:16:12 +0000</pubDate>
		<dc:creator>Gregory Martin</dc:creator>
				<category><![CDATA[Version 4.1.002]]></category>

		<guid isPermaLink="false">http://www.csprousers.org/?p=89</guid>
		<description><![CDATA[CSPro 4.1.002 comes with a few new functions that may come in handy for your data processing needs. The function getusername returns the name under which the user logged onto Windows. This can be useful if you want to restrict access to a data entry program for only a few users. Imagine a control system <a href='http://www.csprousers.org/2011/12/09/new-functions-getusername-randomin-randomizevs/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>CSPro 4.1.002 comes with a few new functions that may come in handy for your data processing needs. The function <strong>getusername</strong> returns the name under which the user logged onto Windows. This can be useful if you want to restrict access to a data entry program for only a few users. Imagine a control system for a data entry operation in which only supervisors have access to parts of the system. By giving the supervisors logins such as super1, super2, etc., you could restrict access as follows:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'>OPERATOR_NAME = <font color='blue'>getusername</font>();</p>
<p><font color='blue'>if</font> <font color='blue'>pos</font>(<font color='fuchsia'>&quot;super&quot;</font>,<font color='blue'>tolower</font>(OPERATOR_NAME)) &lt;&gt; <font color='red'>1</font> <font color='blue'>then</font><br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>errmsg</font>(<font color='fuchsia'>&quot;You must be logged in as a supervisor on this machine to access this program.&quot;</font>);<br />&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>stop</font>(<font color='red'>1</font>);<br /><font color='blue'>endif</font>;</p>
<p>OPERATOR_NUMBER = <font color='blue'>tonumber</font>(OPERATOR_NAME[<font color='red'>6</font>]); <font color='green'>//&nbsp;starting at position 6 will skip past &quot;super&quot;</font></font></div>
<p>The function <strong>randomin</strong> works by accepting as an argument either an in list or a value set. The function then returns a random value that falls somewhere in the listed values. It is now easy to get a random value within a non-continuous range:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>numeric</font> randomElectionYear = <font color='blue'>randomin</font>(<font color='red'>2000</font>,<font color='red'>2004</font>,<font color='red'>2008</font>,<font color='red'>2012</font>);</font></div>
<p>You can weight certain values by repeating the occurrence of the value in the in list. For example, the following example will return three times as many 1 values as 2 values:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>randomin</font>(<font color='red'>1</font>,<font color='red'>1</font>,<font color='red'>1</font>,<font color='red'>2</font>);</font></div>
<p>The function is probably most useful when used with a value set. For example, if you have a data file for a survey and you are planning on adding a question to the survey about religion, you may want to test out your edits for this variable. Your old data does not have this variable, so you would write a batch edit program and then add random religion data to a test data file, which you could pass through your edit programs:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>PROC</font> RELIGION</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;RELIGION = <font color='blue'>randomin</font>(RELIGION_VS1);</font></div>
<p>The <strong>randomizevs</strong> function is useful for data entry applications that use the extended controls introduced in CSPro 4.1. Sometimes you may want to ask questions and randomize the order of the possible responses to avoid bias due to the item positioning. In the preproc of the relevant question, you could execute the randomizevs function to present a different order each time:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>PROC</font> POLITICAL_PARTY</p>
<p><font color='blue'>preproc</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>randomizevs</font>(PARTY_LIST_VSET,<font color='blue'>exclude</font>(<font color='red'>98</font>,<font color='red'>99</font>));</font></div>
<p>In the above example, 98 might be a &#8220;None of the above&#8221; code and 99 might be a &#8220;Do not know&#8221; code. You do not want these codes randomized with the rest, you always want them at the bottom of the value set list, so you exclude them from the randomization.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csprousers.org/2011/12/09/new-functions-getusername-randomin-randomizevs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Multiple Logic Files to an Application</title>
		<link>http://www.csprousers.org/2011/12/09/adding-multiple-logic-files-to-an-application/</link>
		<comments>http://www.csprousers.org/2011/12/09/adding-multiple-logic-files-to-an-application/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 20:26:36 +0000</pubDate>
		<dc:creator>Gregory Martin</dc:creator>
				<category><![CDATA[Version 4.1.002]]></category>

		<guid isPermaLink="false">http://www.csprousers.org/?p=79</guid>
		<description><![CDATA[This code looks like it will not compile correctly: PROC GLOBAL PROC APPLICATION_FF preproc &#160;&#160;&#160;&#160;errmsg(&#34;Welcome to CSPro, this is version %s&#34;,versionNumber()); The compiler may complain that versionNumber is not a function that exists. However, starting in CSPro 4.1.002, you can attach multiple logic files to an application. In this case, if versionNumber is defined in <a href='http://www.csprousers.org/2011/12/09/adding-multiple-logic-files-to-an-application/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>This code looks like it will not compile correctly:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>PROC</font> <font color='blue'>GLOBAL</font></p>
<p><font color='blue'>PROC</font> APPLICATION_FF</p>
<p><font color='blue'>preproc</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>errmsg</font>(<font color='fuchsia'>&quot;Welcome to CSPro, this is version %s&quot;</font>,versionNumber());</font></div>
<p>The compiler may complain that versionNumber is not a function that exists. However, starting in CSPro 4.1.002, you can attach multiple logic files to an application. In this case, if versionNumber is defined in a different file, the code will compile successfully.</p>
<p>When compiling your code, CSPro will load any additional logic files as if the text of these files were inserted in PROC GLOBAL. This means that only things that can go in PROC GLOBAL can be declared in an external logic file, but that includes variables, arrays, and  user-defined functions that you use across many applications. In the above example, I might create a file, myfunctions.app, that contains code that I use frequently. It would look like this:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>function</font> <font color='blue'>alpha</font> versionNumber()</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;versionNumber = &nbsp;<font color='fuchsia'>&quot;4.1.002&quot;</font>;</p>
<p><font color='blue'>end</font>;</font></div>
<p>There is no need to write PROC GLOBAL in this external logic file. To add the file to the application, I select File -> Add Files, and then select my External Logic File:</p>
<p><a href="http://www.csprousers.org/wp-content/uploads/2011/12/20111209include.png"><img src="http://www.csprousers.org/wp-content/uploads/2011/12/20111209include.png" alt="" title="20111209include" width="606" height="256" class="aligncenter size-full wp-image-80" /></a></p>
<p>These files are listed in the tree in the Files window under the main logic file for your application. External logic files can be removed by selecting File -> Drop Files.</p>
<p><a href='http://www.csprousers.org/wp-content/uploads/2011/12/20111209include.zip'>Download the above example as a batch application</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csprousers.org/2011/12/09/adding-multiple-logic-files-to-an-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Small Language Additions: Count, Seek, Sort</title>
		<link>http://www.csprousers.org/2011/12/09/small-language-additions-count-seek-sort/</link>
		<comments>http://www.csprousers.org/2011/12/09/small-language-additions-count-seek-sort/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 20:06:41 +0000</pubDate>
		<dc:creator>Gregory Martin</dc:creator>
				<category><![CDATA[Version 4.1.002]]></category>

		<guid isPermaLink="false">http://www.csprousers.org/?p=76</guid>
		<description><![CDATA[In CSPro 4.1.002 there are three small language changes and additions that may make writing code easier. First, the change: numeric numChildren = count(POP_REC where RELATIONSHIP = 3); //&#160;oldnumeric numChildren = count(RELATIONSHIP = 3); //&#160;new In the past, when using the count function it was necessary to specify what record or group you wanted to <a href='http://www.csprousers.org/2011/12/09/small-language-additions-count-seek-sort/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>In CSPro 4.1.002 there are three small language changes and additions that may make writing code easier. First, the change:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>numeric</font> numChildren = <font color='blue'>count</font>(POP_REC <font color='blue'>where</font> RELATIONSHIP = <font color='red'>3</font>); <font color='green'>//&nbsp;old<br /></font><font color='blue'>numeric</font> numChildren = <font color='blue'>count</font>(RELATIONSHIP = <font color='red'>3</font>); <font color='green'>//&nbsp;new</font></font></div>
<p>In the past, when using the <strong>count</strong> function it was necessary to specify what record or group you wanted to search through (in the above case, POP_REC). Now you can write the code without specifying this clause.</p>
<p>The <strong>seek</strong> function, new to CSPro 4.1, searches a record for the first instance of something being true. Now, in CSPro 4.1.002, you can search for the nth occurrence of the conditional statement. For example, this loop will continue until there are no longer two spouses in a household:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>do</font> <font color='blue'>while</font> <font color='blue'>seek</font>(RELATIONSHIP = <font color='red'>2</font>,@<font color='red'>2</font>)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<font color='green'>//&nbsp;change the second spouse&#8217;s relationship<br /></font><br /><font color='blue'>enddo</font>;</font></div>
<p>Finally, the <strong>sort</strong> function has long been a useful feature of the CSPro language, but now you can use it with a where statement. For example, a common request is to have a roster sorted based on relationships. This example sorts a roster by relationship, and then sorts the children in order by descending age:</p>
<div style='word-wrap:break-word;margin:20px;padding:10px;border:1px dashed #97caff;background-color:#eff6fc;font-family:Courier New;font-size:10pt;'><font color='black'><font color='blue'>sort</font>(POP_REC_EDT <font color='blue'>using</font> RELATIONSHIP);<br /><font color='blue'>sort</font>(POP_REC_EDT <font color='blue'>using</font> -AGE <font color='blue'>where</font> RELATIONSHIP = <font color='red'>3</font>);</font></div>
]]></content:encoded>
			<wfw:commentRss>http://www.csprousers.org/2011/12/09/small-language-additions-count-seek-sort/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

