Chapter Contents |
Previous |
Next |
CREATE |
Required statement | |
Applies to: | access descriptor or view descriptor |
Syntax | |
Details | |
Access descriptors | |
View descriptors | |
no-title for example with id=z0283545 |
Syntax |
CREATE libref.member-name.ACCESS | VIEW; |
Details |
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 |
When you create an access descriptor, you must place statements or groups of statements in a certain order after the PROC ACCESS statement and its options, as listed below:
Information from database-description statements is stored in an access descriptor; therefore, you do not need to repeat this information when you create view descriptors. However, if no security values were entered in the access descriptor or values were provided but the SECURITY statement was set to NO, then you can use the database-description statements in a view descriptor to supply or modify them.
The order of the statements within the database-description group does not matter. For example, you could submit either the DDM= or the NSS() statement first. The order of the statements within the editing group sometimes matters; see the individual statement descriptions for any restrictions.
View descriptors |
You can create view descriptors and access descriptors in the same execution of the ACCESS procedure or in separate executions.
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.
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, the descriptor is saved. If errors are found, error messages are written to the SAS log, and processing is terminated. After you correct the errors, resubmit your statements.
The following example creates the access descriptor ADLIB.CUSTOMER on the ADABAS CUSTOMER file using the ADBFILE statement to specify the ADABAS file.
/* Create access descriptor using ADABAS file */ proc access dbms=adabas; create adlib.customer.access; adbfile(number=45 password=cuspw cipher=cuscc dbid=1); sysfile(number=15 password=cuspwsys cipher=cusccsys dbid=1); secfile(number=16 password=cuspwsec cipher=cusccsec dbid=1); assign=yes; rename cu = custnum ph = phone ad = street; format fo = date7.; informat fo = date7.; content fo = yymmdd8.; mvf br occurs = 4 run;
The following example creates an access descriptor to the same data using the DDM statement.
/* Create access descriptor using NATURAL DDM */ proc access dbms=adabas; create adlib.customer.access; nss(library=sasdemo user=demo password=demopw). sysfile(number=15 password=cuspwsys cipher=cusccsys dbid=1); secfile(number=16 password=cuspwsec cipher=cusccsec dbid=1); ddm=customers; assign=yes; rename customer = custnum telephone = phone streetaddress = street; format firstorderdate = date7.; informat firstorderdate = date7.; content firstorderdate = yymmdd6.; mvf "BRANCH-OFFICE" occurs = 4 run;
The following example creates an access descriptor ADLIB.EMPLOY on the ADABAS EMPLOYEES file and a view descriptor VLIB.EMP1204 based on ADLIB.EMPLOY in the same PROC ACCESS step. The ADABAS file to access is referenced by a DDM.
/* Create access and view descriptors in one execution */ proc access dbms=adabas; /* Create access descriptors */ create adlib.employ.access; nss(library=sasdemo user=demo password=demopw); sysfile(number=15 password=cuspwsys cipher=cusccsys dbid=1); secfile(number=16 password=cuspwsec cipher=cusccsec dbid=1); ddm=employee; assign=no; list all; /* Create view descriptor */ create vlib.emp1204.view; select empid lastname hiredate salary dept sex birthdate; format empid 6. salary dollar12.2 jobcode 5. hiredate datetime7. birthdate datetime7.; subset where jobcode=1204; run;
The following example creates a view descriptor VLIB.BDAYS from the ADLIB.EMPLOY access descriptor, which was created in a separate PROC ACCESS step.
/* Create view descriptors in separate execution */ proc access dbms=adabas 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.