Inserting Data Records

You can insert data records with SYSTEM 2000 by using the insert or the optimized load mode when updating records with various SAS procedures or when loading a database using the DBLOAD procedure. In PROC DBLOAD, you specify the mode by using the S2KLOAD statement.
When a new observation is inserted, it can cause the insertion of more than one SYSTEM 2000 database record. The number of inserts is based on how many levels are in the database, and on a comparison between the data being inserted and the data in the last observation (if any) that was read. During an Insert operation, record levels that have data that is different from the prior observation (if any) result in a SYSTEM 2000 database record being inserted.
You must use Insert mode if you are loading new records into existing logical entries. The insert or the optimized load mode can be used in PROC DBLOAD when you are loading new logical entries. The optimized load mode is more efficient than insert mode, but the optimized load mode has the following restrictions:
  • Data must be sorted in data-tree order before the load.
  • Logical entries are always inserted in their entirety.
  • The number of inserts and the levels at which inserts are performed are based on the order of the data and on which fields change from observation to observation.
  • Your input cannot be a SYSTEM 2000 view in the same environment.
Note: During optimized load processing, your output database is open in exclusive use mode with rollback temporarily disabled.
Insert mode is suitable for mass insertion of descendant records into existing logical entries when using PROC DBLOAD. Similar to the optimized load mode, the interface view engine determines where to insert the new records, based on the values of fields in the observation. When you insert an observation, the engine compares it to the prior observation. Based on how many fields have changed, one or more records are inserted at the levels that have changed. Also, you can use a BY key to help determine where records are inserted. (BY keys are discussed in the next section.)