The ACCESS Procedure for PC Files

UPDATE Statement

Updates a SAS/ACCESS descriptor file.
Note: For DBF, DIF, WK1, WK3, WK4, Excel 4, Excel 5, and Excel 95, file formats under Windows operating environments access descriptor or view descriptor ASSIGN, RESET, SELECT, UNIQUE

Syntax

UPDATE libref.descriptor-name. ACCESS | VIEW ;

Details

Overview

Use the UPDATE statement to perform a quick, simple update of a descriptor. For example, if the PC database file for an existing access descriptor is relocated, you can use UPDATE with the PATH option to specify the new location.
Descriptors modified by UPDATE are not checked for errors. Where validation is crucial, use CREATE to overwrite a descriptor rather than UPDATE. The descriptor is a name in three parts separated by periods (.) .
libref
identifies the library container, which is a location either on the local system's disk or that the local system can directly access. The libref must have been created previously by a LIBNAME statement.
descriptor-name
specifies the descriptor that you are updating, which already exists in libref.
ACCESS
indicates that you are updating an access descriptor while VIEW indicates you are updating a view descriptor.
Multiple UPDATE statements can appear in one ACCESS procedure block. If you use UPDATE to change an access descriptor, one or more UPDATE statements might be required for views that depend on the modified access descriptor. You can use UPDATE and CREATE in the same PROC ACCESS block.

Updating Access Descriptors

The order of statements in an UPDATE block is as follows:
Because the UPDATE block does not validate the updated descriptor, the order of description and editing statements does not matter.
  1. UPDATE must be the first statement after the PROC ACCESS statement with one exception. If the block includes both UPDATE and CREATE statements, either statement can be the first in the block.
  2. Data source description statements: All are allowed.
  3. Editing statements: These editing statements are not allowed: ASSIGN, LIST, RESET, SELECT, VIEW.
    • The descriptor column name can be up to eight characters in uppercase.
    • Column names longer than eight characters are truncated to eight characters.
    • Duplicate names generated by the truncation, have an eight-character name where the eighth character is a number.
    • The view descriptor saves column names as is, in the labels.
    • Full column names are read from the SAS data set variable labels.

Updating View Descriptors

UPDATE must be the first statement after the PROC ACCESS statement with one exception. If the block includes both UPDATE and CREATE statements, either statement can be the first in the block.
  1. Data source description statements: All are allowed.
  2. These editing statements are not allowed: ASSIGN, DROP, RESET, SELECT, and UNIQUE.

Examples

Updating an Existing ACCESS Descriptor

This example updates an existing access descriptor named AdLib.Product:
LIBNAME adlib 'c:\sasdata';

PROC ACCESS DBMS=WK4;
   UPDATE adlib.product.access;
   PATH='c:\lotus\specprod.wk4';
   RENAME= productid prodid
          fibername fiber;
   FORMAT productid  4.
          weight     e16.9
          fibersize  e20.13
          width      e16.9;
RUN;

Update an Access Descriptor and a View Descriptor

This example updates the Employ access descriptor and the View Descriptor for Employ.
LIBNAME adlib 'c:\sasdata';
LIBNAME vlib 'c:\sasviews'
PROC ACCESS DBMS=XLS;
   UPDATE adlib.employ.access;
   PATH='c:\excel\employ.xls';
   LIST all;
   UPDATE vlib.emp1204.view;
   FORMAT empid 6.
     salary dollar12.2
          jobcode 5.
          hiredate datetime9.
          birthdate datetime9.;
   SUBSET WHERE jobcode=1204;
RUN;

Update a Second View Descriptor

Update a second view descriptor that is based on Employ, named BDays, that is also located in 'C:\SASVIEWS'. When you update a view, it is not necessary to specify the access descriptor using the ACCDESC= option in the PROC ACCESS statement. Note that FORMAT can be used because the Employ access descriptor was created with ASSIGN= NO.
LIBNAME vlib 'C:\SASVIEWS';
PROC ACCESS DBMS=XLS;
   UPDATE vlib.bdays.view;
   FORMAT empid 6.
          birthdate datetime7.;
RUN;