Chapter Contents |
Previous |
Next |
SAS/ACCESS Interface to ADABAS Software |
You can use three SAS/FSP procedures: FSBROWSE, FSEDIT, and FSVIEW. The FSBROWSE and FSEDIT procedures show you one ADABAS logical record at a time, whereas the FSVIEW procedure displays multiple logical records in a tabular format similar to the PRINT procedure. PROC FSVIEW enables you to both browse and update ADABAS data, depending on which option you choose.
Using the FSBROWSE Procedure |
The FSBROWSE procedure enables you to look at ADABAS data but does not allow you to change it. To use PROC FSBROWSE, submit the following SAS statements:
proc fsbrowse data=vlib.usacust; run;
Using the FSEDIT Procedure |
proc fsedit data=vlib.usacust; run;
A window similar to the FSBROWSE window opens to enable you to edit the ADABAS data one observation at a time.
Note: When using PROC FSEDIT, you can cancel an edit only before you
scroll. The CANCEL command redisplays the observation as it was before you
began to edit it and cancels your editing changes. After you scroll, the changes
are saved.
Using the FSVIEW Procedure |
To browse ADABAS data, submit the PROC FSVIEW statement as follows. Browse mode is the default for the FSVIEW procedure. The statements display the data as shown in FSVIEW Window Example:
proc fsview data=vlib.usacust; run;
FSVIEW: VLIB.USACUST (B) Command ===> ROW CUSTNUM STATE ZIPCODE COUNTRY 1 12345678 NC 27702 USA 2 14324742 CA 95123 USA 3 14324742 CA 95123 USA 4 14569877 NC 27514 USA 5 14569877 NC 27514 USA 6 14898029 MD 20850 USA 7 14898029 MD 20850 USA 8 14898029 MD 20850 USA 9 15432147 MI 49001 USA 10 18543489 TX 78701 USA 11 18543489 TX 78701 USA 12 18543489 TX 78701 USA 13 19783482 VA 22090 USA 14 19783482 VA 22090 USA 15 19876078 CA 93274 USA 16 19876078 CA 93274 USA |
To see the rest of the accessed ADABAS data,
you must scroll the window to the right multiple times. You can do this by
entering the RIGHT command on the command line or by pressing the function
key assigned to this command.
You can also use the FSVIEW procedure to update ADABAS data. To edit the ADABAS data in a listing format, you have to add EDIT or MODIFY to the PROC FSVIEW statement, as shown in the following statement:
proc fsview data=vlib.usacust edit; run;
The same window as shown in FSVIEW Window Example appears, except the window title contains an (E) for edit, not a (B). SAS/FSP Software: Usage and Reference discusses in detail how to edit data using the FSVIEW procedure.
Note: The CANCEL command
in the FSVIEW window does not cancel your changes, whether you
have scrolled or not.
Specifying a SAS WHERE Expression While Browsing or Editing |
The following example of a WHERE statement retrieves the customers from California. These customers are a subset of the customers for the CUSTOMERS DDM. FSVIEW Window after SAS WHERE Statement shows the FSVIEW window after the following statements have been submitted:
proc fsview data=vlib.usacust edit; where state='CA'; run;
FSVIEW Window after SAS WHERE Statement
FSVIEW: VLIB.USACUST (Subset) Command ===> ROW CUSTNUM STATE ZIPCODE COUNTRY 2 14324742 CA 95123 USA 3 14324742 CA 95123 USA 15 19876078 CA 93274 USA 16 19876078 CA 93274 USA |
Only the logical records with a STATE value of
CA
are retrieved for editing. Note that (Subset) appears after VLIB.USACUST
in the window title to remind you that the data retrieved are a subset of
the data described by the view descriptor. You can then edit each observation
by typing over the information you want to modify. Issue the END command to
end your editing session.
FSVIEW Window after SAS WHERE Command shows the FSVIEW window when the subset of data is generated by the WHERE command:
where state='CA'
FSVIEW Window after SAS WHERE Command
FSVIEW VLIB.USACUST WHERE ... Command ===> ROW CUSTNUM STATE ZIPCODE COUNTRY 2 14324742 CA 95123 USA 3 14324742 CA 95123 USA 15 19876078 CA 93274 USA 16 19876078 CA 93274 USA |
FSVIEW Window after SAS WHERE Statement and FSVIEW Window after SAS WHERE Command are identical, except (Subset) after the title is replaced with WHERE ... in the upper-right corner. You can then update each observation, as described earlier.
Although these examples have shown a SAS WHERE statement and a SAS WHERE command with the FSVIEW procedure, you can also retrieve a subset of data using the FSBROWSE and FSEDIT procedures. For more information on the SAS WHERE statement, refer to SAS Language Reference: Dictionary. For more information about using the SAS WHERE command within the SAS/FSP procedures, refer to SAS/FSP Software: Usage and Reference.
Adding and Deleting Data with the SAS/FSP Procedures |
Adding ADABAS data as a result of any SAS System update operation can cause the interface view engine to decide whether to add a new ADABAS logical record or to modify an existing one, for example, to add an occurrence to a periodic group.
If there are no periodic group fields accessed by the view descriptor or within the ADABAS file, doing an insert is straightforward. However, if a periodic group does exist, then doing an insert is more complicated, because the interface view engine generates multiple SAS observations from a single ADABAS record that contains a periodic group.
Values in the observation to be added are compared to values in the previous observation. If the contents of the previous observation do not help determine whether to add or modify, a new logical record is added. However, it is possible that some of the new values might already reside in the ADABAS file, which would mean that a new logical record is not necessary. This occurs if a periodic group is selected by the view descriptor, and the new data occur only in variables corresponding to data fields that are part of that periodic group.
You can help the interface view engine resolve whether
to add a new logical record or modify an existing one by specifying BY keys.
For information and examples of using BY keys, see Using a BY Key To Resolve Ambiguous Inserts.
When you delete a logical record, the results depend on whether the observation is part of a periodic group. If the logical record is not part of a periodic group, deleting an observation causes a logical record to be deleted from the ADABAS file. However, if the logical record is part of a periodic group, the results of deleting an observation depend on the status of the ADBDEL systems option for the interface view engine, which is set in the ADBEUSE CSECT. For more information, see Systems Options for the ACCESS Procedure and the Interface View Engine.
The following example illustrates using the DELETE command in the FSEDIT procedure. (Note that the ADBDEL systems option is set to N.)
Suppose you want to edit the ADABAS data described by VLIB.USACUST. You can use the FSEDIT procedure with a PROC FSEDIT statement. Scroll forward to the observation to be deleted. In this example, there are three occurrences for the periodic group SIGNATURE-LIST. Deleting an ADABAS Logical Record shows the third occurrence, which you want to delete. (Notice that the variable SL_OCCUR displays the value 3, which tells you that this is the observation for the third occurrence.) Enter the DELETE command on the command line, as shown in Deleting an ADABAS Logical Record, and press ENTER.
Deleting an ADABAS Logical Record
FSEDIT VLIB.USACUST Command ===> delete CUSTNUM: 18543489 STATE: TX ZIPCODE: 78701 COUNTRY: USA NAME: LONE STAR STATE RESEARCH SUPPLIERS FIRSTORD: 10SEP79 SL_OCCUR: 3 LIMIT: 100000.00 SIGNATUR: EVAN MASSEY BRANCH_2: DALLAS |
The DELETE command processes the deletion and displays a message to that effect, as shown in Deletion Message Displayed. There is no indication of what actions the interface view engine actually took.
FSEDIT VLIB.USACUST DELETED Command ===> NOTE: Observation has been deleted. CUSTNUM: ________ STATE: __ ZIPCODE: ______ COUNTRY: ____________________ NAME: _____________________________________ FIRSTORD: _______ SL_OCCUR: _________ LIMIT: __________________ SIGNATUR: ______________________________ BRANCH_2: _________________________ |
The entire observation seems to have been removed from the ADABAS file, but this is not the case. For the third occurrence, the interface view engine sets the values for data fields LIMIT and SIGNATUR to missing; the other data remain the same. Regardless of the actions though, the observation you deleted is no longer available for processing. For more information on using the SAS/FSP procedures, see SAS/FSP Software: Usage and Reference.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.