• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image 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
        • EndCase Statement
        • Export Statement
        • Freq Statement (Unnamed)
        • GetDeck Function
        • PutDeck Function
        • Set Behavior Export Statement
        • SetOutput Function
        • Skip Case Statement
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

SetOutput Function

Format
b = setoutput(file_name);
Description
The setoutput function redirects the output cases of a batch application to the data file specified in the string expression file_name. All data will be appended to (added to the end of) the file. If the file exists prior to the application run, you may, depending on the circumstances, want to use the filedelete function to remove the file.
You can use a single file name as an argument or you can specify a string List. Using a List allows you to specify multiple output files. Cases will be output to each of the output files specified.
This function cannot be used in data entry applications.
Return Value
The function returns a logical value of 1 (true) if at least one physical file is successfully assigned and 0 (false) otherwise.
Example
PROC PROVINCE

   
// split the contents of the input data file into one file for each province code;
    // the output files will be put in a directory called "split"
    string output_path = Path.concat("split", maketext("%02d.dat", PROVINCE));

   
setoutput(output_path);
See also: SetFile Function, Skip Case Statement