Previous Page | Next Page

The ACCESS Procedure for PC Files

UPDATE Statement


Updates a SAS/ACCESS descriptor file.
Valid: for DBF, DIF, WK1, WK3, WK4, Excel 4, Excel 5, and Excel 95 file formats under Windows operating environments
Applies to: access descriptor or view descriptor
Not allowed with: ASSIGN, RESET, SELECT, UNIQUE

UPDATE <libref.descriptor-name.>ACCESS|VIEW ;


Details

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 previously created by a LIBNAME statement.

descriptor-name

specifies the descriptor you are updating, which already exists in libref.

See CREATE Statement.
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:

  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.

Since the UPDATE block does not validate the updated descriptor, the order of description and editing statements does not matter.


Updating View Descriptors

  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, DROP, RESET, SELECT, and UNIQUE.


Examples


Updating an Existing

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;

This example updates the Employ access descriptor that is located in 'c:\sasdata' , for the spreadsheet named 'c:\excel\employ.xls' and updates the view descriptor for Employ named Emp1204, located in 'c:\sasviews' :

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;

This example updates 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 ACCDESC=) 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;

Previous Page | Next Page | Top of Page