Chapter Contents |
Previous |
Next |
DBF |
OS/390 specifics: | all |
Syntax |
PROC DBF options ; |
If the fileref is allocated with a FILENAME statement, the statement may optionally specify RECFM=N to identify the DBF file as binary.
The DBn option must correspond to the version of dBASE with which the DBF file is compatible. Specify a DBF file with the DBn option, where n is 2, 3, 4, or 5. You can specify only one of these values.
Details |
You can use PROC DBF in the OS/390 environment if your site has a license for SAS/ACCESS for PC File Formats. To see a list of your licences, submit:
proc setinit; run;
If you are licensed, you will see an entry in your SAS log for SAS/ACCESS for PC File Formats.
The DBF procedure converts files in DBF format to SAS data sets that are compatible with the current SAS release. You can also use PROC DBF to convert SAS data sets to files in DBF format.
Before you convert a DBF file to a SAS file, you must first upload your DBF file from the Windows, OS/2, NT, or UNIX environment to the OS/390 environment, using a mechanism such as FTP (file transfer protocol). If you are licensed for SAS/CONNECT, you can use PROC UPLOAD:
filename out1 'sasdemo.emp.dbf'; proc upload infile='c:\employee\emp.dbf' outfile=out1 binary; run;
In the OS/390 environment, sequential data sets are recommended for use with DBF, with the following attributes:
RECFM=FS | |
DSORG=PS | |
LRECL=6160 | |
BLKSIZE=6160 |
sasdemo.emp.dbf = (DSORG=PS,RECFM=FS,LRECL=6160,BLKSIZE=6160)
PROC DBF produces one output file but no printed output. The output file contains the same information as the input file but in a different format.
The DBF procedure works with DBF files created by all
the current versions and releases of dBASE (II, III, III PLUS, IV, and 5.0)
and with most DBF files that are created by other software products.
DBF fields whose data are stored in auxiliary files (Memo, General, binary, and OLE data types) are ignored in SAS.
If a DBF file has missing numeric or date fields, SAS fills those missing fields with a series of the digit 9 or with blanks, respectively.
When a dBASE II file is translated into a SAS data set,
any colons in dBASE variable names are changed to underscores in SAS variable
names. Conversely, when a SAS data set is translated into a dBASE file, any
underscores in SAS variable names are changed to colons in dBASE field names.
In DBF files, numeric variables are stored in character form. When converting from a SAS data set to a DBF file, SAS numeric variables become DBF numeric variables with a total length of 16. A SAS numeric variable with a decimal value must be stored in a decimal format in order to be converted to a DBF numeric field with a decimal value. In other words, unless you associate the SAS numeric variable with an appropriate format in a SAS FORMAT statement, the corresponding DBF field will not have any value to the right of the decimal point. You can associate a format with the variable in a SAS data set when you create the data set or by using the DATASETS procedure (see DATASETS).
If the number of
digits--including a possible decimal
point--exceeds 16, a warning message is issued and the DBF numeric field
is filled with a series of the digit 9. All SAS character variables become
DBF fields of the same length. When converting from a SAS data set to a DBF
file that is compatible with dBASE III or later, SAS date variables become
DBF date fields. When converting to a dBASE II file, SAS date variables become
dBASE II character fields in the form YYYYMMDD.
Example 1: Converting a dBASE IV File to a SAS Data Set |
libname save 'sasdemo.employee.data'; filename dbfin 'sasdemo.employee.dbf'; proc dbf db4=dbfin out=save.employee; run;
Example 2: Converting a dBASE 5 file to a SAS Data Set |
In this example, a dBASE 5 file is converted to a SAS data set.
libname demo 'sasdemo.employee.data'; filename dbfout 'sasdemo.newemp.dbf' recfm=n; proc dbf db5=dbfout data=demo.employee; run;
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.