The following is an example of a SAS 7 or later update of data. The SAS 7 or later
data set, MyData.SSNums, is updated with data that is described by the
view descriptor Vlib.SSName. Both the data in the data set and in the view descriptor are sorted
by Social Security number before the output data set is used to update the existing
data set.
To perform the update,
you would enter the following statements:
proc sort data=mydata.ssnums;
by soc_sec_number;
run;
proc print data=mydata.ssnums;
title2 'MYDATA.SSNUMS Data Set';
run;
proc sort data=vlib.ssname out=mydata.newnums;
by soc_sec_number;
run;
proc print data=mydata.newnums;
title2 'Data Described by MYDATA.NEWNUMS';
run;
data mydata.newnames;
update mydata.ssnums mydata.newnums;
by soc_sec_number;
run;
proc print data=mydata.newnames;
title2 'MYDATA.NEWNAMES Data Set';
run;
The new
SAS data file MyData.NewNames is a 7 or later data file that is stored in a 7 or later library
associated with the
libref MyData. The following three outputs show the results of the PRINT procedures for
the original data file, the transaction data, and the updated data file.
Data in the Data File to Be Updated, MyData.SSNums
The SAS System
MYDATA.SSNUMS Data Set
soc_sec_
OBS number customer_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 That Is Described by Updated Data File MyData.NewNums
The SAS System
Data Described by MYDATA.NEWNUMS
SOC_SEC_
OBS NUMBER CUSTOMER_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
Results of Updating a 7 or Later SAS Data File with IMS Data
The SAS System
MYDATA.NEWNAMES Data Set
soc_sec_
OBS number customer_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