Chapter Contents |
Previous |
Next |
UPDATE |
Optional statement | |
Applies to: | access descriptor or view descriptor |
Syntax | |
Details | |
Updating access and view descriptors | |
Examples |
Syntax |
UPDATE libref.member-name.ACCESS | VIEW; |
The descriptor that you update can exist in either a temporary (WORK) or permanent SAS data library. If the descriptor has been protected with a SAS password that prohibits editing of the ACCESS or VIEW descriptor, then the password must be specified on the UPDATE statement.
To update a descriptor, use its three-level name. The first level identifies the libref of the SAS data library where you stored the descriptor. The second level is the descriptor's name (member name). The third level is the type of SAS file.
You can use the UPDATE statement as many times as necessary in one procedure execution. That is, you can update 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 update access descriptors and view descriptors in separate executions of the procedure.
Rules that applied to the CREATE statement under Version 6 of SAS/ACCESS software apply to the UPDATE statement. For example, the SUBSET statement is valid only for updating view descriptors and it is not valid for access descriptors.
Note: The following statements are not supported when
using the UPDATE statement: ASSIGN, RESET, SELECT, and UNIQUE.
Updating access and view descriptors |
You can update view descriptors and access descriptors in the same execution of the ACCESS procedure or in separate executions.
When you update an access or view descriptor, you must place statements or groups of statements in a certain order after the PROC ACCESS statement and its options, as listed below:
The following editing statements are not allowed when you specify the UPDATE statement: SELECT, RESET, ASSIGN, and UNIQUE. LIST can only be used with views.
Note: Altering a DBMS table that has descriptor files
defined on it might invalidate these files or cause them to be outdated. If
you recreate 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.
Examples |
The following example updates an access descriptor ADLIB.EMPLOY on the Oracle Rdb table EMPLOYEES and then re-creates a view descriptor VLIB.EMP1204, which was based on ADLIB.EMPLOY. The original access descriptor included all of the columns in the table. Using the LIST statement enables you to write all of the variables to the SAS log so you can see the complete access descriptor before you update it.
In this example, the SALARY and BIRTHDATE columns are dropped from the access descriptor so that users cannot see this data. Because SELECT and RESET are not supported when UPDATE is used, the view descriptor VLIB.EMP1204 must be re-created to omit the SALARY and BIRTHDATE columns.
proc access dbms=rdb; /* update access descriptor */ update adlib.employ.access; drop salary birthdate; list all; /* re-create view descriptor */ create vlib.emp1204.view; select empid hiredate dept jobcode gender lastname firstname middlename phone; format empid 6. jobcode 5. hiredate datetime9.; subset where jobcode=1204; run;
The following example updates a view descriptor VLIB.BDAYS from the ADLIB.EMPLOY access descriptor, which was created previously. In this example, the WHERE clause replaces the WHERE clause that was specified in the original view descriptor. The SUBSET statement contains an ORACLE-specific SQL statement.
proc access dbms=oracle; update vlib.bdays.view; subset where hiredate= to_date('10OCT1988','ddmonyyyy'); run;
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.