Database Reference
In-Depth Information
8.7 Overview of CSV and CSVALL Examples
Example 8.8.1 includes ODS commands to execute the CSV and CSVALL features. There is more than one
way to write a CSV file using ODS. All six sets of code shown in Example 8.8.1 write the same data to an
output file into either a CSV or CSVALL directory with a slightly different name. All six of these methods
are part of Base SAS, and they all produce the same output. The code in Figures 8.3 and 8.4 and shown in
Example 8.8.1 demonstrates that there are only minor differences in the output files. However, if you need
an output file without titles you should use the CSV tagset.
Table 8.3 describes the examples shown in this chapter. Some of the examples here have minor overlaps in
the features to show how they interact when additional features are included. Example 8.8.1 will show
outputs from both the CSV and CSVALL tagset executions. However, the other examples will focus on the
output from only one tagset.
Table 8.3: List of Examples for ODS CSV and CSVALL Tagsets or Destinations.
Example Number
General Description
8.8.1
Simple CSV and CSVALL File Default Output Differences . This
example compares the default behavior of both the CSV and
CSVALL tagset output files.
8.8.2
CSV and CSVALL Title and Footnote Output Differences. This
example shows the differences in the output files when more than
one ODS output is written to a CSV file, and compares the CSV
output to output produced by using CSVALL. Both PROC PRINT
and PROC FREQ are used in this example, along with WHERE and
BY clauses.
Write Currency Values as Unformatted Numbers. This example
shows how to write currency values as numbers without the dollar
signs and punctuation. The input file has whole dollar amounts, and
therefore the output file displays whole dollar values only. Only a
CSVALL example is shown.
8.8.3
8.8.4
Change Delimiters When Outputting Data with CSV Tagset.
This example shows how to create a “Tab”-delimited file using the
CSV tagset. Any other single character can be used as a delimiter,
but try to pick one that does not appear in the data to avoid problems.
Only a CSV example is shown. This example also shows the
difference between a *.csv file and a *.tab file when opened with
Excel.
Save Leading Zeroes in Character Fields Sent to Excel. This
example uses the QUOTE_BY_TYPE='Yes' and the
PREPEND_EQUALS='Yes' options to preserve leading zeros for
variables that are read into an Excel workbook. Only a CSV example
is shown.
8.8.5
8.8 CSV and CSVALL Examples to Write *.csv Files
Example 8.8.1 Simple CSV and CSVALL File Default Output Differences
The examples shown in this section relate to the CSV and CSVALL tagset templates. I will start by
showing the differences between the two tagset templates. The CSV tagset template is the “Parent” tagset
template, while the CSVALL tagset template is a child template. Essentially, the CSVALL tagset template
just changes some defaults, and then uses all of the code in the CSV tagset template. The CSV tagset
template is referred to in PROC TEMPLATE as a “PARENT.”
 
 
Search WWH ::




Custom Search