Previous Page | Next Page

File-Specific Reference for the ACCESS and DBLOAD Procedures

DBLOAD Procedure: DBF Specifics (Windows)

See The DBLOAD Procedure for general information about this feature. This section provides DBF-specific syntax for the DBLOAD procedure and describes DBLOAD procedure data conversions DBLOAD Procedure Data Conversions for DBF Files.


DBLOAD Procedure Syntax for DBF Files

To create and load a DBF table, SAS/ACCESS Interface to PC Files uses the following statements:

PROC DBLOAD DATA=<libref.SAS data-set>;
DBMS=DBFMEMO
PATH='path-and-filename.DBF'|< filename>|<fileref>
VERSION=<dBASE-product-number>
ACCDESC=<libref.access-descriptor>
DELETE <variable-identifier-1>... <variable-identifier-n>
ERRLIMIT=<error-limit>
LABEL
LIMIT=<load-limit>;
LISTALL|FIELDS|<variable-identifier>
LOAD
RENAME <variable-identifier-1>=<database-field-name-1>...<variable-identifier-n><database-field-name-n>
RESET ALL|<variable-identifier-1> ...<variable-identifier-n>
TYPE <variable-identifier-1>=database-field-type-1...<<variable-identifier-n>=<database-field-type-n>'>
WHERE <SAS where-expression>
RUN;

The QUIT statement is also available in PROC DBLOAD. It causes the procedure to terminate. QUIT is used most often in interactive line mode and batch mode to exit the procedure without exiting SAS.

The following list provides detailed information about the DBF-specific statements:

VERSION= dBASE-version-number

specifies the version of the dBASE product that you are using, such as dBASE IV. The dBASE-version-number argument can be one of the following values: II, III, IIIP, IV, V, 2, 3, 3P, 4, and 5.

Specify VERSION= before the TYPE statement in order to get the correct data types for your new DBF table.

Default: V
TYPE variable-identifier-1 = 'database-field-name-1' <... variable-identifier-n = 'database-field-name-n'>

specifies a DBF file data type, which is based on the SAS variable format. The database field name must be enclosed in quotation marks.

This example defines the data types for several database fields. You can specify the length of the data type.

PROC DBLOAD DBMS=DBFMEMO DATA=employee;
  PATH='c:\sasdemo\employee.dbf';
  RENAME firstname = fname;
  TYPE   empid     = 'numeric(6)'
         hiredate  = 'date'
         salary    = 'numeric(10,2)'
         jobcode   = 'numeric(5)';
  RUN;

This example creates a DBF table, Exchange.Dbf, from the data file DLib.RateOfex. An access descriptor DbFliba.Exchange is created based on the new table. You must be granted the appropriate privileges to create DBF tables.

LIBNAME dbfliba 'SAS data-library';
LIBNAME dlib 'SAS data-library';

PROC DBLOAD DBMS=DBFMEMO DATA=dlib.rateofex;
   PATH='c:\dbfiles\sasdemo\exchange.dbf';
   ACCDESC=dbFliba.exchange;
   RENAME fgnindol=fgnindolar 4=dolrsinfgn;
   TYPE country='char(25)';
   LOAD;
RUN;


DBLOAD Procedure Data Conversions for DBF Files

DBF File Data Types Assign Corresponding SAS Variable Formats
SAS Variable Formats DBF File Data Types
$w. CHAR(n)
w. NUMERIC
w.d. NUMERIC
datetimew.d DATE
datew. DATE
ew. FLOAT
binaryw. NUMERIC


Setting Environment Variables for DBF Files

Missing numeric values are replaced with nines by default. The DBFMISCH environment variable is used to change the default. Specify the character that the interface to DBF files represents as missing data in numeric fields. If you write a SAS file with a missing numeric variable to a DBF file, the corresponding field in the DBF file is filled with the DBFMISCH character. Conversely, any numeric or float field in a DBF file that is filled with the DBFMISCH character is treated as missing when read by SAS.

Set the DBFMISCH environment variable in the SAS configuration file as follows:

-SET DBFMISCH value

Valid values are as follows:

any single character

to fill missing numeric values with any character (zero in this code), -SET DBFMISCH 0 .

NULLS

to replace missing numeric values with binary zeros,-SET DBFMISCH NULLS .

BLANKS

replace missing numeric values with blanks, -SET DBFMISCH BLANKS .

Previous Page | Next Page | Top of Page