Chapter Contents

Previous

Next
SAS/ACCESS Interface to IMS-DL/I Software

Updating a SAS Data File with IMS-DL/I Data

You can update a SAS data file with IMS-DL/I data described by a view descriptor just as you can update a SAS data file using another data file: by using a DATA step UPDATE statement. In this section, the term transaction data refers to the new data that are to be added to the original file.

You can even perform updates when the file to be updated is a Version 6 data file with user-defined, 8-byte SAS variable names and the transaction data are from a Version 7 source. Version 7 uses generated SAS variable names of up to 32 bytes.

You have two choices when you update a Version 6 SAS data file with Version 7 data:

The VALIDVARNAME SAS System option lets you control what type of variable names will be used in a SAS session. It enforces the naming conventions by converting any nonconforming names to the necessary format. The default format is V7. When a Version 6 program is run under V7, the software replaces the 8-byte Version 6 variable names created with the SASNAME= (sn=) parameter with longer SAS variable names generated from the ITEM name. When a Version 7 program is run and VALIDVARNAME=V6, the longer variable names are truncated to 8 bytes. The conversion is permanent: when a conversion is made, the original names are not stored.

The following examples illustrate the situations in which each of the options is appropriate.


Example of VALIDVARNAME=V6

Suppose you have a Version 6 SAS data set, VER6.SSNUMS, which contains some customer names and Social Security numbers. You want to update this data set with data described by VLIB.SSNAME, a view descriptor based on the CUSTOMER segment of the IMS-DL/I database ACCTDBD. Since this will require you to first sort the data then create an output data set with the sorted data, this is a good situation for using VALIDVARNAME=V6.

To perform the update, you would enter the following SAS statements:

options validvarname=V6;
options nodate linesize=80;
libname ver6 'SAS-data-library';

proc sort data=ver6.ssnums;
   by ssnumb;
run;

proc print data=ver6.ssnums;
   title2 'VER6.SSNUMS Data File';
run;

proc sort data=vlib.ssname out=mydata.newnums;
   by ssnumb;
run;

proc print data=mydata.newnums;
   title2 'Data Described by MYDATA.NEWNUMS';
run;

data mydata.newnames;
   update ver6.ssnums mydata.newnums;
   by ssnumb;
run;

proc print data=mydata.newnames;
   title2 'MYDATA.NEWNAMES Data File';
run;

The new SAS data file MYDATA.NEWNAMES is a Version 6 data file stored in a Version 6 data library associated with the libref MYDATA.

Data in the Data File to Be Updated, VER6.SSNUMS, Data Described by Updated Data File MYDATA.NEWNUMS, and Data in the Updated Data File MYDATA.NEWNAMES show the results of PRINT procedures for the original data file, the transaction data, and the updated data file.

Data in the Data File to Be Updated, VER6.SSNUMS
                    The SAS System           
                  VER6.SSNUMS Data File             
                                                  
      OBS      SSNUMB       NAME                     
                                                  
       1     267-83-2241    GORDIEVSKY, OLEG         
       2     276-44-6885    MIFUNE, YUKIO            
       3     352-44-2151    SHIEKELESLAM, SHALA      
       4     436-46-1931    NISHIMATSU-LYNCH, CAROL

Data Described by Updated Data File MYDATA.NEWNUMS
                            The SAS System                   
                  Data Described by MYDATA.NEWNUMS          
                                                            
    OBS  SSNUMB                  NAME                               
                                                            
      1  156-45-5672             O'CONNOR, JOSEPH                   
      2  178-42-6534             PATTILLO, RODRIGUES                
      3  234-74-4612             WIKOWSKI, JONATHAN S.              
      4  434-62-1224             SMITH, JAMES MARTIN                
      5  434-62-1234             SUMMERS, MARY T.                   
      6  436-42-6394             BOOKER, APRIL M.                   
      7  456-45-3462             LITTLE, NANCY M.                   
      8  657-34-3245             BARNHARDT, PAMELA S.               
      9  667-73-8275             WALLS, HOOPER J.                   
     10  667-82-8275             COHEN, ABRAHAM 

Data in the Updated Data File MYDATA.NEWNAMES
                          The SAS System
                    MYDATA.NEWNAMES Data File


   OBS    SSNUMB         NAME

     1    156-45-5672    O'CONNOR, JOSEPH
     2    178-42-6534    PATTILLO, RODRIGUES
     3    234-74-4612    WIKOWSKI, JONATHAN S.
     4    267-83-2241    GORDIEVSKY, OLEG
     5    276-44-6885    MIFUNE, YUKIO
     6    352-44-2151    SHIEKELESLAM, SHALA
     7    434-62-1224    SMITH, JAMES MARTIN
     8    434-62-1234    SUMMERS, MARY T.
     9    436-42-6394    BOOKER, APRIL M.
    10    436-46-1931    NISHIMATSU-LYNCH, CAROL
    11    456-45-3462    LITTLE, NANCY M.
    12    657-34-3245    BARNHARDT, PAMELA S.
    13    667-73-8275    WALLS, HOOPER J.
    14    667-82-8275    COHEN, ABRAHAM

For more information on the UPDATE statement, see SAS Language Reference: Dictionary.


Chapter Contents

Previous

Next

Top of Page

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