DUMPSAS - Create a text data file from a SAS system file
The DUMPSAS macro creates a data file containing the data from a
SAS Data set. The SAS statements necessary to re-create the SAS
Data set precede the data lines. DUMPSAS is stored on the STATS
disk on YorkVM1.
%macro dumpsas( data=_LAST_ , /* Sas Data Set name */
fileref=DUMP , /* SAS Fileref/DDname */
linesize=, ls=80 , /* Linesize of external file */
width=9 , /* Default Field width */
compare=NO , /* Add code to compare datasets */
special= , /* Vars needing wider fields */
specwid=24 ); /* Field width for above */
You have a Version 5 SAS system file POOLS.CATDATA on your CMS
A-disk. To convert it to a SAS program file (CATDATA SAS A)
containing the raw data and SAS program statements,
- Connect to the STATS disk on CMS by running the command,
GETDISK STATS
- Create the following SAS program (DUMPIT SAS A)
%include dumpsas ;
libname pools V5 '*';
%dumpsas( data=pools.catdata ,
fileref=catdata sas);
- Run the program
sas dumpit
Note that for SAS Version 5 system files, the V5 keyword
must be specified on the LIBNAME statement. This is
unnecessary for Version 6 system files.
This example assumes that all numeric
variables will fit within the default field width (9).
If not, the names of these variables should be specified
using the SPECIAL= and SPECWID= parameters. The width of
character variables is handled automatically.
The macro parameters are:
- DATA=
- Names the SAS Data set to dump from, usually
the "two-part" name of a permanent SAS
data set. Default: the last-created data set.
- FILEREF=
- Name the SAS Fileref identifing the external
file to contain the data. CMS users must
include the DISP MOD option on the FILEDEF
command defining the enternal file. On some
operating systems, the external file name may be
used instead of the fileref (CMS, PC DOS). If
not specified, the macro creates the fileref.
- LINESIZE=
- Specifies the linesize of the external data
file. This value MUST be greater than or equal
to the length of the longest character variable.
You may also need to include the linesize
information on the operating system command used
to allocate the external file. The default 80.
- WIDTH=
- Specifies the default field width for
numeric variables. The default width is 9.
- COMPARE=
- If COMPARE=YES, additional SAS statements
are included in the file that allow the
reconstructed SAS Data set to be compared with
the original. Variables that do not compare are
usually the result of a field width too small to
maintain precision.
- SPECIAL=
- Specifies a list of numeric variable names
that require a wider field in order to maintain
precision
- SPECWID=
- Specifies the field width used for the
variables listed in the SPECIAL= parameter.
Credit
DUMPSAS was written by: Kevin Thompson, Agric.
Stat. Lab., Univ of Ark., (KT227032@UAFSYSB.BITNET), 8Sep88