data company;
input Name $ 1-25 Age 27-28 Gender $ 30; datalines; Vincent, Martina 34 F Phillipon, Marie-Odile 28 F Gunter, Thomas 27 M Harbinger, Nicholas 36 M Benito, Gisela 32 F Rudelich, Herbert 39 M Sirignano, Emily 12 F Morrison, Michael 32 M ; run;proc sort data=company;
by Name;
run;data finance;
input IdNumber $ 1-11 Name $ 13-37 Salary; datalines; 074-53-9892 Vincent, Martina 35000 776-84-5391 Phillipon, Marie-Odile 29750 929-75-0218 Gunter, Thomas 27500 446-93-2122 Harbinger, Nicholas 33900 228-88-9649 Benito, Gisela 28000 029-46-9261 Rudelich, Herbert 35000 442-21-8075 Sirignano, Emily 5000 ; run;proc sort data=finance;
by Name;
run; proc printdata=company;
title 'Little Theater Company Roster'; run; proc printdata=finance;
title 'Little Theater Employee Information'; run;
data repertory;
input Play $ 1-23 Role $ 25-48 IdNumber $ 50-60;
datalines;
No Exit Estelle 074-53-9892
No Exit Inez 776-84-5391
No Exit Valet 929-75-0218
No Exit Garcin 446-93-2122
Happy Days Winnie 074-53-9892
Happy Days Willie 446-93-2122
The Glass Menagerie Amanda Wingfield 228-88-9649
The Glass Menagerie Laura Wingfield 776-84-5391
The Glass Menagerie Tom Wingfield 929-75-0218
The Glass Menagerie Jim O'Connor 029-46-9261
The Dear Departed Mrs. Slater 228-88-9649
The Dear Departed Mrs. Jordan 074-53-9892
The Dear Departed Henry Slater 029-46-9261
The Dear Departed Ben Jordan 446-93-2122
The Dear Departed Victoria Slater 442-21-8075
The Dear Departed Abel Merryweather 929-75-0218
;
run;
proc print data=repertory;
title 'Little Theater Season Casting Assignments';
run;
proc sort data=finance;
by IdNumber;
run;proc sort data=repertory;
by IdNumber;
run; proc printdata=finance;
title 'Little Theater Employee Information'; title2 '(sorted by employee ID number)'; run; proc printdata=repertory;
title 'Little Theater Season Casting Assignments'; title2 '(sorted by employee ID number)'; run;
Rudelich
, Herbert
)
and Salary (35000
) that were retained in
the program data vector for the second observation in the new data
set. The next figure illustrates this behavior.
data newrep(drop=IdNumber);
merge finance(drop=Salary)
repertory; by IdNumber; run; proc print data=newrep; title 'Final Little Theater Season Casting Assignments'; run;
/* Sort FINANCE and COMPANY by Name */proc sort data=finance;
by Name;
run;proc sort data=company;
by Name;
run; /* Merge COMPANY and FINANCE into a */ /* temporary data set. */data temp;
merge company finance;
by Name;
run;proc sort data=temp;
by IdNumber;
run; /* Merge the temporary data set with REPERTORY */data all;
merge temp repertory;
by IdNumber;
run; proc print data=all; title 'Little Theater Complete Casting Information'; run;
3.142.84.25