• <Helps for GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Array Object
      • Audio Object
      • Barcode
      • File Object
      • Freq Object
      • HashMap Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • Appendix
  • <Helps for CSEntry>
  • <Helps for CSBatch>
  • <Helps for CSTab>
  • <Helps for DataViewer>
  • <Helps for TextView>
  • <Helps for TblView>
  • <Helps for TRSWin>
  • <Helps for CSDeploy>
  • <Helps for CSPack>
  • <Helps for CSFreq>
  • <Helps for CSSort>
  • <Helps for CSExport>
  • <Helps for CSReFmt>
  • <Helps for CSDiff>
  • <Helps for CSConcat>
  • <Helps for TRSSetup>
  • <Helps for ParadataViewer>
  • <Helps for ParadataConcat>
  • <Helps for CSIndex>
  • <Helps for Excel2CSPro>
  • <Helps for CSWeb>

Alphabetical List of Functions and Statements

The following table lists functions and statements that can be used in logic. In addition, some CSPro objects have functions that can be invoked on the object. A list of such functions can be found in the summary pages for each of these objects: array, audio, file, freq, hashmap, list, map, pff, SystemApp, and valueset.
Function/StatementDescription
absReturns the absolute value of a numeric expression.
acceptReturns the number of a choice from a list made by the data entry operator.
adjlbaAdjusts the lower bound of the CMC of an event based on an age.
adjlbiAdjusts the lower bound of the CMC of an event offset by a number of months.
adjubaAdjusts the upper bound of the CMC of an event based on an age.
adjubiAdjusts the upper bound of the CMC of an event offset by a number of months.
advanceMoves forward field by field to a specified field during data entry.
aliasCreates an aliased name for a dictionary item, typically to shorten or standardize names.
alphaDeclares alphanumeric variables used in the application.
arrayDeclares an array object for storing a collection of numbers or strings.
askConditionally jumps forward to the next field during data entry.
audioDeclares an audio object for recording or playing audio.
averageReturns the average of an item that occurs multiple times.
 
barcode.readReads a barcode and returns its value as a string.
breakExits a do, while, or for loop early and continues execution with the first statement after the enddo.
 
changekeyboardModifies the keyboard input associated with certain fields.
clearInitializes the memory values of data items defined in external files to zero or blank.
closeCloses a previously opened file.
cmcodeReturns the number of months since the year 1900 given a month and year.
compareReturns the alphabetical order (i.e., collating sequence) of the two strings.
compressCompresses some number of files into a single .zip file.
concatJoins two or more strings into one string.
configDeclares string variables prefilled with values defined in the configuration settings.
connectionDetermines whether the device has access to the Internet.
countReturns the number of occurrences for a repeating form or roster.
countcasesReturns the number of cases in an external file that meet a certain criterion.
countnonspecialReturns the number of non-special values in a group of data items.
curoccReturns the current occurrence number for a repeating form, roster, or record.
 
dateaddCalculates a new date from a starting date and a period of elapsed time.
datediffCalculates the difference between two dates.
datevalidDetermines whether a date in the format YYYYMMDD is valid.
decompressDecompresses a .zip file, extracting some number of files.
delcaseMarks a case for deletion in an external file based on a key.
deleteRemoves a record or item occurrence from the current case.
demodeReturns the current data entry mode.
diagnosticsReturns troubleshooting information about CSPro.
dircreateCreates a new directory with the given directory name.
dirdeleteDeletes an empty directory or group of empty directories.
direxistDetermines whether a directory exists.
dirlistReturns a list containing the file and directory listing of the specified directory.
displayDisplays a message (this function has been superceded by errmsg).
doExecutes one or more statements repeatedly while a logical condition remains true or until a logical condition is no longer true.
 
editConverts a number to a string.
editnoteDisplays the data entry note box for adding or changing.
encodeEncodes special characters to facilitate writing to HTML or CSV files and writing to other formats.
endcaseEnds batch editing for the current case (but outputs the case to file).
endgroupEnds data entry for the current record or group/roster.
endlevelEnds data entry for the current level.
enterEnters data from a secondary form file.
errmsgDisplays or writes a message.
ensureConditionally declares numeric variables used in the application.
execpffStarts another CSPro application.
execsystemStarts another application or process.
exitEnds a procedure before normal processing is expected to end.
expReturns the value of e raised to a given power.
exportWrites a record to an export file.
 
fileDeclares one or more files used in the application.
fileconcatConcatenates a list of files or a set of files described by a wildcard specification.
filecopyCopies a file to another file.
filecreateCreates a new file with the given file name.
filedeleteDeletes a file or group of files.
fileemptyDetermines whether a file exists but is empty.
fileexistDetermines whether a file exists.
filenameReturns the file name currently associated with a dictionary or a file.
filereadReads a text line from a file into an item or variable.
filerenameChanges the name of a file.
filesizeReturns the size of a file in bytes.
filetimeReturns the last modification date/time of a file or a directory.
filewriteWrites a line of text to a file.
findDetermines the existence of a case in a data file that matches a condition.
forLoops through multiple records or items.
for (dictionary)Loops through the cases selected during a selcase operation.
forcaseLoops through the cases in an external file.
functionDeclares a user-defined function.
 
getbluetoothnameReturns the name of the device as broadcast to other Bluetooth devices.
getbufferReturns a string containing the contents of a data item.
getcapturetypeReturns the capture type associated with a field.
getcaselabelReturns a string containing a case's label (the text that appears in a case listing).
getdeckRetrieves a value from a DeckArray used for editing data.
getdeviceidReturns a string that contains a unique value that identifies the device.
getimageReturns the filename of a value set image.
getlabelReturns the label of a dictionary symbol or text associated to symbol's value.
getlanguageReturns the current language being used while in data entry mode.
getnoteReturns a field or case note.
getocclabelReturns an occurrence label associated with a repeating dictionary item or a roster.
getoperatoridReturns the text entered in the operator ID.
getorientationReturns the display orientation.
getosReturns information about the operating system, including whether it is running Android or Windows.
getpropertyReturns information about an application or field property.
getrecordReturns the name of the record containing a particular item.
getsymbolReturns the name of the current procedure being executed.
getusernameReturns the name of the user logged into Windows or the Android device account.
getvalueReturns the value of a numeric variable whose identity is only known at runtime.
getvaluealphaReturns the value of a alpha variable whose identity is only known at runtime.
getvaluenumericReturns the value of a numeric variable whose identity is only known at runtime.
gpsControls and returns values from a GPS receiver.
 
hasDetermines whether any of a group of repeating items is within a range of values.
hashCalculates the hash value of a string.
hashmapDeclares a hashmap object for storing a collection of numbers or strings in an associative array.
hideoccVisually hides an occurrence row in a roster.
highReturns the maximum value in a group of numeric expressions.
highlightedReturns whether a field is on path or reached during data entry.
 
ifExecutes statements conditionally.
imputeAssigns a value to a data item and logs the frequency of assignments.
inDetermines whether a variable is within a range of values.
incIncrements a numeric item.
insertCreates a record or item occurrence in the current case.
intReturns the integer portion of a numeric expression.
invaluesetDetermines whether a data item's value is within the item's value set.
ischeckedReturns whether a code is checked as part of a check box field's selections.
ispartialDetermines whether a case was opened from a partial case or not.
isverifiedDetermines whether a case was verified by double-keying.
 
keyReturns the key (ID string) of the currently loaded case.
keylistReturns a list containing the keys (ID strings) of cases in a file.
killfocusDeclares that the following statements are executed after the object stops being active.
 
lengthReturns the length of a dictionary item or a string.
listDeclares a list object for storing a collection of numbers or strings.
loadcaseReads a case from an external file into memory (usually based on a key).
loadsettingReturns a string containing a setting saved using the savesetting function.
locateFinds but does not load a case in an external file that matches a condition.
logReturns the base-10 logarithm of a numeric expression.
logtextWrites a user-defined message to the paradata log file.
lowReturns the minimum value in a group of numeric expressions.
 
maketextReturns a formatted string with inserted values.
mapDeclare a map variable that can be used to display interactive maps.
maxReturns the maximum value of an item that occurs multiple times.
maxoccReturns the maximum number of occurrences of a multiply occurring object.
maxvalueReturns the maximum value in an item's range of acceptable values.
minReturns the minimum value of an item that occurs multiple times.
minvalueReturns the minimum value in an item's range of acceptable values.
moveMoves backwards or forwards to a specified field during data entry.
 
nextEnds a do, while, or for loop early and continues execution with the next iteration of the loop.
nmembersReturns the number of cases selected during a selcase operation.
noccursReturns the number of occurrences for a repeating form or roster.
noinputPrevents input for the current field during data entry.
numericDeclares numeric variables used in the application.
 
OnChangeLanguageProvides control over actions to occur after a user has changed the language.
OnCharAllows users to trap characters in order to perform special actions or to change the action of the character.
onfocusDeclares that the following statements are executed just before an object becomes active.
OnKeyAllows users to trap keystrokes in order to perform special actions or to change the action of the key.
OnRefusedProvides a way to override the selection of a refused value.
onoccchangeDeclares that the following statements are executed when the group's current occurrence changes.
OnStopProvides control over stopping or exiting data entry.
OnSyncMessageAllows users to respond to a message sent by a Bluetooth client using syncmessage.
OnSystemMessageProvides a way to override the displaying of system error messages.
openOpens a dictionary or external file.
 
paradataPerforms an action on the paradata log.
path.concatCombines multiple strings into one string representing a file path.
path.getDirectoryNameExtracts the directory name from a file path.
path.getExtensionExtracts the file extension from a file path.
path.getFileNameExtracts the file name from a file path.
path.getFileNameWithoutExtensionExtracts the file name without its extension from a file path.
pathconcatCombines multiple strings into one string representing a file path.
pathnameReturns the path of various special directories.
pffDeclare a pff variable that can be used to dynamically modify the way other CSPro applications are executed.
posReturns the position of a string within another string.
poscharReturns the position of any of a series of characters within another string.
preprocDeclares that the following statements are executed at the beginning of a block.
procDeclares the beginning of a new procedure.
promptPrompts the operator to enter an alphanumeric string, also supporting a password masking option.
protectModifies the protected property of a field.
postprocDeclares that the following statements are executed at the end of a block.
publishdateReturns the date and time that the code was compiled (which can be used to determine when a .pen file was created).
putdeckPuts a value in a DeckArray used for editing data.
putnotePuts the contents of string to a field or case note.
 
randomReturns a pseudo-random integer in a given range.
randominReturns a pseudo-random integer in a non-continuous range, or using a value set.
randomizevsRandomizes the order of a value set.
recodeAssigns a value to a variable based on the value of one or more other variables.
reenterForces the data entry operator to reenter a previous entered field.
regexmatchReturns whether a string matches the regular expression.
relationDefines a relation between multiple records or items.
replaceReturns a string with one of more instances of a substring replaced with new text.
reportGenerates a templated report.
retrieveLoads a case from the current position of an external file.
roundReturns a value rounded to the nearest integer.
 
savepartialSaves the current case as a partially added, modified, or verified case.
savesettingSaves, using an attribute-value pair, a setting retrievable with the loadsetting function.
seedInitializes the random number generator to a particular starting place.
seekSearches a multiply occurring item for an item that meets a condition.
seekmaxSearches a multiply occurring item for an item with the highest value that meets a condition.
seekminSearches a multiply occurring item for an item with the lowest value that meets a condition.
selcaseAllows a data entry operator to select and load a case from an external file.
setSets the values of various system parameters.
set accessSets the order in which cases in a data file are processed.
set attributesModifies the field properties in a data entry application.
set behaviorModifies parameters related to field validation or sets export parameters.
set firstPositions the first case in a data file as the next case to be processed.
set errmsgModifies the way that error messages are displayed on desktop CSEntry.
set lastPositions the last case in a data file as the next case to be processed.
setcaptureposAllows the manual declaration of the window coordinates of the capture type.
setcapturetypeSets the capture type associated with a field.
setcaselabelSets a case's label (the text that appears in a case listing).
setfileAssigns a new physical file to a dictionary or declared file.
setfontChanges the default display font in data entry applications.
setlanguageModifies the current language being used while in data entry mode.
setlbReturns the lower bound of the CMC of an event.
setocclabelSets the occurrence label associated with a repeating dictionary item or a roster.
setoperatoridChanges the operator ID associated with the data entry session.
setorientationModifies the display orientation, allowing dynamic rotation of the display.
setoutputChanges the output file where cases are saved in a batch application.
setpropertyModifies an application or field property.
setreportdataStores a piece of data to be used in a templated report.
setubReturns the upper bound of the CMC of an event.
setvalueAssigns a value to a variable whose identity is only known at runtime.
setvaluesetDynamically modifies the value set of an item.
setvaluesetsDynamically modifies the value sets for all items in the dictionary.
showDisplays the occurrences of one or more items from a record or multiply occurring item.
showarrayDisplays the values of one or more elements from an array.
showoccVisually shows (or hides) an occurrence row in a roster.
skipJumps forward to a specified field during data entry.
skip caseEnds processing of the current case in a batch edit run.
soccursReturns the number of occurrences of a record.
sortSorts occurrences of records or items based on the value of an item.
specialDetermines whether a variable's value is missing, refused, notappl, or default.
sqlqueryExecutes a query on a SQLite database and returns a result set in a variety of formats.
sqrtReturns the square root of a numeric expression.
startswithReturns whether a string begins with a specified prefix.
stopEnds a data entry session or batch edit run.
stringDeclares variable-length alphanumeric variables used in the application.
stripRemoves trailing blanks from a string.
sumReturns the sum of an item that occurs multiple times.
swapSwitches the order of two occurrences within a group.
syncappUpdates an application from a new version of the deployed package on a server.
syncconnectConnects to a CSWeb, Dropbox, or FTP server, or to another device using Bluetooth, to begin a synchronization session.
syncdataSends or receives cases between the current device and a server or another device.
syncdisconnectEnds the current synchronization session.
syncfileSends or receives files between the current device and a server or another device.
syncmessageSends and receives a string message to a Bluetooth server.
syncparadataSends or receives paradata between the current device and a server or another device.
syncserverStarts running a server on the current device, to which other devices can connect using Bluetooth.
sysdateReturns the current system date.
sysparmReturns a parameter a PFF file.
SystemAppDeclares a SystemApp object for interacting with external applications.
systimeReturns the current system time.
 
timestampReturns the current UNIX time.
timestringReturns a custom formatted date and time string.
tolowerChanges all uppercase letters in a string to lowercase.
tonumberConverts a string to a number.
totoccReturns the total occurrences for a repeating form, roster, or record.
toupperChanges all lowercase letters in a string to uppercase.
trTranslates a string literal into an appropriate string based on the application's current language.
traceControls a window or file that can contain debugging information.
 
universeSpecifies a condition that must be true for execution of a procedure or function to continue.
userbarControls the optional display bar in a data entry application.
uuidReturns a human-readable string containing a universally unique identifier.
 
valuesetDeclares a valueset object for storing the contents of a dynamic value set.
viewLaunches the system's default viewer to display a file or website.
visualvalueReturns the value of a data item prior to its input.
 
warningDisplays a "soft check" message only when the operator is not advancing in the case.
whenExecutes a statement based on the value of one or more other variables.
whileExecutes one or more statements repeatedly while a logical condition remains true.
writeWrite to a text file.
writecaseWrites a case from memory to an external file.
See also: List of Reserved Words