space
Previous Page | Next Page

ACCESS Procedure Reference

UPDATE Statement



Updates a SAS/ACCESS descriptor file.
Optional statement
Applies to: access descriptor or view descriptor

Syntax
Details

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. 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 on 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 will not know of it until you use the descriptor in a SAS procedure such as PROC PRINT.  [cautionend]

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 and its accompanying statements are checked for errors when you submit the procedure for processing. If you update multiple descriptors in the same procedure execution, each UPDATE statement (and its accompanying statements) is checked for errors as it is processed. In either case, the UPDATE statement must be the first statement after the PROC ACCESS statement (Note: The ACCDESC= parameter cannot be specified on the PROC ACCESS statement).

When the RUN statement is processed, all descriptors are 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 statements are not supported when using the UPDATE statement: ASSIGN, RESET, SECURITY, SELECT, and MVF 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.  [cautionend]

The following example updates the access descriptor MYLIB.ORDER on the ADABAS file ORDER. In this example, the column names are changed and formats are added.

  proc access dbms=adabas;
     update mylib.order.access;
     rename ordernum ord_num
            fabriccharges fabrics;
     format firstorderdate date7.;
     informat firstorderdate date7.;
     content firstorderdate yymmdd6.;
   run;

The following example updates an access descriptor ADLIB.EMPLOY on the ADABAS file EMPLOYEE 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 file. 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.EMP1204 must be re-created in order to omit the salary and birthdate columns.

  proc access dbms=adabas;
     /* 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 sex
            lastname firstname middlename phone;
     format empid 6.
            hiredate date7.;
     subset where jobcode=1204;
  run;

The following example updates a view descriptor VLIB.BDAYS from the ADLIB.EMPLOY access descriptor, which was created in a separate procedure execution. In this example, the WHERE clause replaces the WHERE clause that was specified in the original view descriptor.

  proc access dbms=adabas
     update vlib.bdays.view;
     subset;
     subset where empid GT 212916;
  run;

space
Previous Page | Next Page | Top of Page