UPDATE Statement

Updates a SAS/ACCESS descriptor file.

Type: Optional statement
Applies to: access descriptor or view descriptor

Syntax

UPDATE libref.member-name.ACCESS | VIEW
<password-level=SAS-password> ;

Details

The UPDATE statement identifies an existing access descriptor or view descriptor that you want to update (edit). The descriptor can exist in either a temporary (Work) or permanent SAS 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 in the UPDATE statement.
Note: It is recommended that you re-create (or overwrite) your descriptors rather than update them. SAS does not validate updated descriptors. If you create an error while updating a descriptor, you do not know of it until you use the descriptor in a SAS procedure such as PROC PRINT.
To update a descriptor, use its three-level name. The first level identifies the libref of the SAS 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: ACCESS or VIEW.
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.
You can use the CREATE statement and the UPDATE statement in the same procedure execution.
If you update only one descriptor in a procedure execution, the UPDATE statement must be the first statement after the PROC ACCESS statement. (Note that the ACCDESC= parameter cannot be specified in the PROC ACCESS statement.)
The following statements are not supported when using the UPDATE statement: ASSIGN, RESET, SELECT, and OCCURS subcommands RESET and SELECT.
Note: You cannot create a view descriptor after you have updated a view descriptor in the same procedure execution. You can create a view descriptor after updating or creating an access descriptor or after creating a view descriptor.
The following example updates the access descriptor MYLIB.ORDERS on the CA-Datacom/DB table ORDER. In this example, the SAS column names are changed and formats are added.
  
proc access dbms=Datacom;
   update mylib.orders.access;
   rename ordernum ord_num fabriccharges fabrics;
   format firstorderdate date7.;
   informat firstorderdate date7.;
   content firstorderdate yymmdd6.;
run;
The following example updates an access descriptor MYLIB.EMPLOYEE on the CA-Datacom/DB table EMPLOYEES and then re-creates a view descriptor VLIB.EMPS, which was based on MYLIB.EMPLOYEE. The original access descriptor included all of the DBMS columns in the table. Here, the SALARY and BIRTHDATE columns are dropped from the access descriptor so that users cannot see this data. Because RESET is not supported when UPDATE is used, the view descriptor VLIB.EMPS must be re-created in order to omit the SALARY and BIRTHDATE columns.
proc access dbms=Datacom;
   /* update access descriptor  */
   update mylib.employee.access;
   drop salary birthdate;
   list all;

   /* re-create view descriptor */
   create vlib.emps.view;
   select empid hiredate dept jobcode sex 
      lastname firstname middlename phone;
   format empid 6.
   hiredate date7.;
   subset where jobcode=1204;
run;