Chapter Contents |
Previous |
Next |
PROC DIF |
Syntax |
PROC DIF options; |
filename myref '/my_dir/myfile.dif'
).
If you specify a filename instead of a fileref, you can only specify the name itself (omitting the .DIF extension) and the file must be in the current directory. For example, this PROC DIF statement creates the EMP.DIF file from the MYLIB.EMPLOYEE data set:
proc dif dif=emp data=mylib.employee;You cannot specify
emp.dif
or a full pathname (
proc dif dif='/my/unix_directory/emp.dif'
) in
the DIF option. If OUT= is omitted, SAS creates a temporary data set in the WORK library. (Under UNIX, the temporary data set is named DATA1 [...DATAn]; under PCs, it is called _DATA_. If OUT= is omitted or if you do not specify a two-level name in the OUT= option, the SAS data set created by PROC DIF remains available during your current SAS session but is not permanently saved.
Details |
The DIF procedure converts Data Interchange Format (DIF) files to SAS data sets that are compatible with the current release of SAS software. This procedure can also be used to convert SAS data sets to DIF files.
PROC DIF produces one output file but no printed output. The output file contains the same information as the input file but in a different format.
Software Arts, Inc. developed the Data Interchange Format to be used as a common language for data. Originally, DIF was made popular by products such as Lotus 1-2-3 and VisiCalc. Although DIF is not as popular today as it once was, it is still supported by many software products.
Note: Any DIF file that you plan to convert to a SAS data
set should be in a tabular form. All items in a given column should represent
the same type of data. If any rows in the DIF file contain inconsistent
data-for example, a row of underscores, dashes, or blanks-delete
these rows before converting the DIF file to a SAS data set. It is recommended
that you make a backup copy of your DIF table before you make these modifications.
When converting from a DIF file to a SAS data set, each row of the DIF file becomes an observation in the SAS data set. Conversely, when converting a SAS data set to a DIF file, each SAS observation becomes a row in the DIF file. To use the DIF procedure, you must have a SAS/ACCESS interface to PC File Formats license.
Converting DIF Variables to SAS Variables |
Numeric variables, which can be represented in either integer or scientific notation in a DIF file, become SAS numeric variables when a DIF file is converted to a SAS data set.
Transferring SAS Data Sets to and from Other Software Products Using DIF |
To send SAS data sets to another software product using DIF files, you must first run PROC DIF to convert your SAS data set to a DIF file. Use whatever facility is provided by the target software product to read the DIF file. For example, you use the Lotus 1-2-3 Translate Utility to translate a DIF file to a 1-2-3 worksheet file. (This facility might be provided by an import tool or from a File --> Open dialog box in that software product.) After the application reads the DIF file data, the data can be manipulated and saved in the application's native format.
To transfer data in the opposite direction--for example, from a software product to a SAS data set--the process is reversed. First, export the data to a DIF file and then run PROC DIF to read the DIF file into a SAS data set.
Missing Values |
When a SAS data set that has missing values for some numeric variables is converted to a DIF file, the following assignments are made in the DIF file for the variables with missing values:
0
NA
.
Examples |
libname save '/my/my_unx_dir'; proc dif dif=employee out=save.employee; run;
In this example, a SAS data set is converted to a DIF file. A FILENAME statement is used to specify a fileref that names the DIF file. You must specify the FILENAME statement before the PROC DIF statement.
filename employee 'c:\sasdemo\employee.dif'; proc dif dif=employee data=save.employee; run;
Or, in a UNIX environment, this example would be:
filename employee '/sasdemo/employee.dif'; proc dif dif=employee data=save.employee; run;
See Also |
"Programmer's Guide to the DIF," Software Arts Technical Notes (SATN-18).
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.