Sample 24959: Using ODS to Generate a CSV File Directly On a PC
An experimental feature of Release 8.2, you can now use ODS to generate a CSV
(Comma Separated Variable) file on the z/OS platform. Once generated, you can
import the file into any PC-based application that understands CSV files,
including all the major spreadsheet packages.
In this example, a SAS program running on z/OS generates a CSV file from
a PROC PRINT and writes it to a PC file. Once on the PC, it is accessed
as a CSV file by a standard spreadsheet program.
The keys to this example are the Output Delivery System and the FTP access method:
- the FILENAME statement specifies that myfile is written with the
FTP access method.
- the ODS statement directs the PROC step output to myfile.
To run this example, you need to provide the PC filename, the PC
target directory, the target PC's hostid and its userid. These parameters are
highlighted in red.
The option prompt generates a prompt for the desktop password.
You can substitute pass='xxxx' for prompt to specify the
password explicitly.
|
|
ods listing close;
/* --------------------------------------------------------
|
FILENAME Options |
ftp |
evokes the ftp access method |
prompt |
generates a password prompt |
recfm=s |
specifies a binary transfer |
debug |
displays ftp messages |
--------------------------------------------------------- */
filename myfile ftp
'shoes.csv'
cd=
'c:\pcdir\'
host=
'mypcid.mycompany.com'
user=
'userid'
prompt
recfm=s
debug;
/* --------------------------------------------------------
|
ODS Options |
csv |
generates CSV output |
myfile |
fileref of output file |
trantab |
generates pc file with ascii chars |
--------------------------------------------------------- */
ods csv file = myfile
trantab=ascii;
proc print data=sashelp.shoes;
where region="Canada";
run;
ods csv close;
ods listing;
quit;
|
CSV File: Using ODS to Generate a CSV File Directly On a PC
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
In this example, a SAS program running on z/OS generates a CSV file from a PROC PRINT and writes it to a PC file. Once on the PC, it is accessed as a CSV file by a standard spreadsheet program.
| Type: | Sample |
| Topic: | SAS Reference ==> ODS (Output Delivery System) Third Party ==> Information Exchange ==> FTP (File Transfer Protocol)
|
| Date Modified: | 2005-04-06 03:02:04 |
| Date Created: | 2005-01-03 11:03:19 |
Operating System and Release Information
| SAS System | Base SAS | z/OS | 8.2 TS2M0 | n/a |