Chapter Contents

Previous

Next
UPDATE

UPDATE



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 (edit). The descriptor 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.

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 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: 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: The ACCDESC= parameter cannot be specified on 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.  [cautionend]

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;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.