Chapter Contents |
Previous |
Next |
CREATE |
Required statement | |
Applies to: | access descriptor or view descriptor |
Syntax | |
Details | |
Access descriptors | |
View descriptors | |
Example |
Syntax |
CREATE libref.member-name.ACCESS | VIEW; |
To create a descriptor, use a three-level name. The
first level identifies the libref of the SAS data library where you will store
the descriptor. You can store the descriptor in a temporary (WORK) or permanent
SAS data library. The second level is the descriptor's name (member name).
The third level is the type of SAS file: specify
ACCESS
for an access descriptor
or
VIEW
for a view descriptor.
You can use the CREATE statement as many times as necessary in one procedure execution. That is, you can create multiple access descriptors, as well as one or more view descriptors based on these access descriptors, within the same execution of the ACCESS procedure. Or, you can create access descriptors and view descriptors in separate executions of the procedure.
Access descriptors |
The order of the statements within the database connection group does not matter. The order of the statements within the editing group sometimes matters; see the individual statement descriptions for any restrictions.
Note: Altering a DBMS table that has descriptor files
defined on it might invalidate these files or cause them to be outdated. If
you re-create a table, add a new column to a table, or delete an existing
column from a table, use the UDPATE statement to modify your descriptors to
use the new information.
View descriptors |
To create a view descriptor and the access descriptor on which it is based within the same PROC ACCESS execution, you must place the statements or groups of statements in a particular order after the PROC ACCESS statement and its options, as listed below:
The order of the statements within this group usually does not matter; see the individual statement descriptions for any restrictions.
Note: You cannot use the DROP statement when you create
a view descriptor. Instead, use SELECT to specify the columns you want.
To create a view descriptor based on an access descriptor that was created in a separate PROC ACCESS step, you specify the access descriptor's name in the ACCDESC= option in the new PROC ACCESS statement. You must specify the CREATE statement before any of the editing statements for the view descriptor.
If you create only one descriptor in a PROC step, the CREATE statement and its accompanying statements are checked for errors when you submit PROC ACCESS for processing. If you create multiple descriptors in the same PROC step, each CREATE statement (and its accompanying statements) is checked for errors as it is processed.
When the RUN statement is processed, all descriptors are saved if no errors are found. If errors are found, error messages are written to the SAS log, processing is terminated, and the descriptors are not saved. After you correct the errors, resubmit your statements.
Example |
The following example creates an access descriptor ADLIB.EMPLOY on the Oracle Rdb table EMPLOYEES and a view descriptor VLIB.EMP1204 based on ADLIB.EMPLOY in the same PROC ACCESS step.
proc access dbms=rdb; /* create access descriptor */ create adlib.employ.access; database='qa:[dubois]textile'; table=employees; assign=no; list all; /* create view descriptor */ create vlib.emp1204.view; select empid lastname hiredate salary dept gender birthdate; format empid 6. salary dollar12.2 jobcode 5. hiredate datetime9. birthdate datetime9.; subset where jobcode=1204; run;
The following example creates a view descriptor VLIB.BDAYS from the ADLIB.EMPLOY access descriptor, which was created in the previous PROC ACCESS step.
proc access dbms=rdb accdesc=adlib.employ; create vlib.bdays.view; select empid lastname birthdate; format empid 6. birthdate datetime7.; run;
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.