Chapter Contents

Previous

Next
UPDATE

UPDATE



Updates a SAS/ACCESS descriptor file.

Optional statement
Applies to: access descriptor or view descriptor
Not allowed with: ASSIGN, RESET, SELECT, UNIQUE


Syntax
Details
Updating access descriptors
Updating view descriptors
Examples

Syntax

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
is the descriptor you are updating. It must already exist in libref. (See CREATE for an explanation of how to create descriptors.)

ACCESS
indicates you are updating an access descriptor while VIEW indicates you are updating a view descriptor.

Multiple UPDATE statements may appear in one ACCESS procedure block. If you use UPDATE to change an access descriptor, one or more UPDATE statements may 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 may be the first in the block.

  2. DBMS description statements are next. All are allowed.

  3. Editing statements are next. 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 may be the first in the block.

  2. DBMS description statements are next. All are allowed.

  3. Editing statements are next. These editing statements are not allowed: ASSIGN, DROP, RESET, SELECT, and UNIQUE.


Examples

The following example upates 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;

The following example updates the access descriptor EMPLOY, 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;

The following example updates a second view descriptor that is based on EMPLOY named BDAYS. It 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 access descriptor EMPLOY was created with ASSIGN=NO.

libname vlib 'c:\sasviews';

proc access dbms=xls;
   update vlib.bdays.view;
   format empid 6.
          birthdate datetime7.;
run;


Chapter Contents

Previous

Next

Top of Page

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