![]() Chapter Contents |
![]() Previous |
![]() Next |
| SAS/ACCESS Interface To ADABAS: Reference |
The BY key comparison process is as follows:
| BY Key Examples |
Suppose you are working with the following two ADABAS logical records, which make up three SAS observations as shown in By Key Example Containing Two ADABAS Logical Records of Three SAS Observations. The data field named DF1 is specified as a BY key. DF2 is a periodic group consisting of data fields DF21 and DF22.
By Key Example Containing Two ADABAS Logical Records of Three SAS Observations
Data Fields DF1 DF2
DF21 DF22
Record 1 A CCC 1 (obs 1)
CCC 2 (obs 2)
Record 2 B DDD 3 (obs 3) |
You are in the FSEDIT procedure on observation 1. You enter an ADD or a DUP command and the values A, CCC, and 4. This is not an ambiguous insert, and a BY key is not required. Results of Entering an ADD or DUP Command shows the result.
Results of Entering an ADD or DUP Command
Data Fields DF1 DF2
DF21 DF22
Record 1 A CCC 1 (obs 1)
CCC 2 (obs 2)
CCC 4 (new observation (obs 4))
Record 2 B DDD 3 (obs 3) |
You are in the FSEDIT procedure on observation 1. You enter an ADD or a DUP command and the values B, DDD, and 5 for data fields DF1, DF21, and DF22, respectively. This is an ambiguous insert because all the values you are entering are different than the ones in observation 1. If there were not a BY key, the result would be as shown in Results of an Ambiguous Insert.
Results of an Ambiguous Insert
Data Fields DF1 DF2
DF21 DF22
Record 1 A CCC 1 (obs 1)
CCC 2 (obs 2)
CCC 4 (obs 3)
Record 2 B DDD 3 (obs 4)
Record 3 B DDD 5 (new observation) |
With a BY key, the engine locates the BY key value DF1=B. Results with a BY Key shows the result.
Data Fields DF1 DF2
DF21 DF22
Record 1 A CCC 1 (obs 1)
CCC 2 (obs 2)
CCC 4 (obs 3)
Record 2 B DDD 3 (obs 4)
DDD 5 (new observation) |
You are in the FSVIEW procedure, looking at the first three observations. You decide to add the values B, DDD, and 7 at the end. The current position is the third observation on the display. Results without a By Key shows the result with no BY key.
Data Fields DF1 DF2
DF21 DF22
Record 1 A CCC 1 (obs 1)
CCC 2 (obs 2)
CCC 4 (obs 3)
Record 2 B DDD 3 (obs 4)
DDD 5 (obs 5)
Record 3 B DDD 7 (new observation) |
Results with a BY Key shows the result with a BY key.
Data Fields DF1 DF2
DF21 DF22
Record 1 A CCC 1 (obs 1)
CCC 2 (obs 2)
CCC 4 (obs 3)
Record 2 B DDD 3 (obs 4)
DDD 5 (obs 5)
DDD 7 (new observation) |
| BY Key Considerations |
When specifying BY keys for your view descriptors, keep in mind the following considerations:
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.