ACCESS Procedure Reference |
Optional statement | |
Applies to: | access descriptor or view descriptor |
Syntax | |
Details |
Syntax |
UPDATE libref.member.ACCESS | VIEW; |
Details |
The UPDATE statement identifies an existing access descriptor or view descriptor that you want to change. The descriptor can exist in 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.
To update a descriptor, use its three-level name. The first level identifies the libref of the library where you stored the descriptor. The second level is the descriptor's member name. The third level is the type of SAS file: ACCESS or VIEW. For a view descriptor, you can specify the PSBNAME and PCBINDEX arguments.
You can use the UPDATE statement as many times as necessary in one procedure. Use these guidelines to write the UPDATE statement:
Like the CREATE statement, the UPDATE statement should immediately follow PROC ACCESS and precede any database definition and editing statements. Also, all database definition statements should precede any editing statements.
Within the database definition group, the DELETE, INSERT, and REPLACE statements can be specified in any order and can occur multiple times with an UPDATE sequence. The order has no effect on processing.
When using index numbers, the numbers specified with the UPDATE statement refer to the original pre-update order. Index numbers used with editing statements always apply to the post-update, "ready to rewrite" order.
Use the LIST statement after the UPDATE statement and avoid using intermediate LIST statements, particularly in batch mode. The LIST statement forces a reorganization of the in-memory layout of the access or view descriptor. Intermediate list statements change the index numbering at each invocation and can cause an error.
Do not attempt to 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.
/* ----example 1------ */ proc access dbms=ims; update imslib.custs.access; insert address; item=address2 lv=3 dbf=$12 se=custadd2; delete contact; repl 23 se=custphon; ins 23; item=newitem lv=3 dbf=$30 se=custlsti; run; /* ---example 2--- */ proc access dbms=ims; update imslib.custs.access; delete contact; repl 23 se=custphon; ins 23; item=newitem lv=3 dbf=$30 se=custlsti; insert address; item=address2 lv=3 dbf=$12 se=custadd2; run;
The following example shows how index numbers are interpreted by different parts of an UPDATE statement. In the example, the DELETE statement processes the third item in the original descriptor. The DROP statement, however, processes the fourth item in the post-update order, which in this case would have been the fifth item in the original sequence.
proc access dbms=ims; update imslib.custs.access; delete 3; /* pre-update item 3 */ drop 4; /* post-update item 4 */ list all; run;
Pre-update and post-update listings are shown below.
/* ---prior to UPDATE --- */ IMS Database: CUSTOMER Function: Create Descriptors-access: CUSTS1 view: L# Item Name DBFormat Format 1 01 CUSTOMER *RECORD* *RECORD* 2 02 CUSTOMER-INFO *GROUP* *GROUP* 3 03 CUSTOMER-CODE $8. $8. 4 03 STATE $2. $2. 5 03 ZIP 10.0 12.0 6 03 COUNTRY $20. $20. /* ---after UPDATE --- */ IMS Database: CUSTOMER Function: Create Descriptors-access: CUSTS1 view: L# Item Name DBFormat Format 1 01 CUSTOMER *RECORD* *RECORD* 2 02 CUSTOMER-INFO *GROUP* *GROUP* 3 03 STATE $2. $2. 4 03 ZIP *NON-DISPLAY* 10.0 12.0 5 03 COUNTRY $20. $20.
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.