File-Specific Reference for the ACCESS and DBLOAD Procedures |
See The ACCESS Procedure for PC Files for general information about this feature. This section provides DBF-specific syntax for the ACCESS procedure and describes ACCESS procedure data conversions.
ACCESS Procedure Syntax for DBF Files |
To create an access descriptor, use the DBMS=DBFMEMO option and the database-description statement PATH= option. This PATH= option supplies DBF-specific information to SAS and must immediately follow the CREATE statement. In addition to the database-description statement, you can use optional editing statements when you create an access descriptor. These editing statements must follow the database-description statement.
The database-description statement is required only when you create access descriptors. Because the DBF information is stored in an access descriptor, you do not need to repeat this information when you create view descriptors.
Note: The SAS/ACCESS interface cannot read DBF files that are encrypted. Therefore, you cannot define an access descriptor based on these files.
The SAS/ACCESS interface to DBF supports the following procedure statements:
PROC ACCESS <option(s)>
CREATE <libref.name.>ACCESS|VIEW PATH=<path-and-filename.DBF>|<filename>|<fileref> UPDATE libref.name.ACCESS|VIEW ASSIGN | AN YES | NO DROP <'column-identifier-1'>... <'column-identifier-n'> FORMAT <'column-identifier-1'><'SAS format-name-1'>...<'column-identifier-n'>... <'SAS format-name-n'> LIST ALL |VIEW|<'column-identifier'> RENAME <'column-identifier-1'>=<'SAS variable-name-1'>...<'column-identifier-n'>= <'SAS variable-name-n'> RESET ALL|<'column-identifier-1'>...<'column-identifier-n' > SELECT ALL|<'column-identifier-1'>...<'column-identifier-n'> SUBSET <selection criteria> UNIQUE=YES|NO |
RUN ; |
The QUIT statement is also available in the Access procedure. 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.
This example creates an access descriptor and a view descriptor based on DBF file data.
OPTIONS LINESIZE=80; LIBNAME adlib 'SAS data-library'; LIBNAME vlib 'SAS data-library'; PROC ACCESS DBMS=dbfmemo; /* create access descriptor */ CREATE adlib.custs.access; PATH='c:\dbfiles\dbcusts.dbf'; ASSIGN=yes; RENAME customer = custnum; FORMAT firstorder DATE9.; LOST all; /* create usacust view */ CREATE vlib.usacust.view; SELECT customer state zipcode name firstorder; RUN;
ACCESS Procedure Data Conversions for DBF Files |
The table below shows the default SAS variable formats that the ACCESS procedure assigns to each DBF file data type. If DBF file data falls outside of the valid SAS data ranges, you get an error message in the SAS log when you try to read the data.
DBF File Data Type | SAS Variable Format |
---|---|
Character(n) |
$n.(n<=
200)
$200. (n>200) |
Numeric(N,n) | (N,n) |
Float(N,n)* | (N,n) |
Date | MMDDYY8. |
Logical | $1. |
* This data type applies to dBASE V and later. Check with other software products' documentation to determine whether this data type applies. |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.