Advantages
|
Disadvantages
|
---|---|
|
|
Advantages
|
Disadvantages
|
---|---|
|
|
data data3; merge data1 data2; by x; run; proc sql; create table data3 as select data1.x, data1.y, data2.z from data1, data2 where data1.x=data2.x; quit;
1
for X in Data1
is matched and combined with each observation from Data2 that has
a value of 1
for X. Then, the second
observation that has a value of 1
for
X in Data1is matched and combined with each observation from Data2
that has a value of 1
for X, and so
on.
proc sql; create table work.data3 as select * from data1, data 2 where data1.x=data2.x; quit;
Date
|
Destination
|
FlightNumber
|
EmpID
|
---|---|---|---|
01MAR2000
|
YYZ
|
132
|
1739
|
01MAR2000
|
YYZ
|
132
|
1478
|
01MAR2000
|
YYZ
|
132
|
1130
|
01MAR2000
|
YYZ
|
132
|
1390
|
01MAR2000
|
YYZ
|
132
|
1983
|
01MAR2000
|
YYZ
|
132
|
1111
|
01MAR2000
|
YYZ
|
182
|
1076
|
01MAR2000
|
YYZ
|
182
|
1118
|
EmpID
|
JobCode
|
LastName
|
FirstName
|
---|---|---|---|
1350
|
FA3
|
Arthur
|
Barbara
|
1574
|
FA2
|
Cahill
|
Marshall
|
1437
|
FA3
|
Carter
|
Dorothy
|
1988
|
FA3
|
Dean
|
Sharon
|
1983
|
FA2
|
Dunlap
|
Donna
|
1125
|
FA2
|
Eaton
|
Alicia
|
1475
|
FA1
|
Fields
|
Diana
|
1422
|
FA1
|
Fletcher
|
Marie
|
proc sql; create table flightemps as select flightschedule.*, firstname, lastname from sasuser.flightschedule, sasuser.flightattendants where flightschedule.empid=flightattendants.empid; quit;
proc sort data=sasuser.flightattendants out=fa; by empid; run; proc sort data=sasuser.flightschedule out=fs; by empid; run; data flightemps2; merge fa fs; by empid; run;
data combine; set dataset1; set dataset2; run;
data flightemps3(drop=empnum jobcode); set sasuser.flightschedule; do i=1 to num; set sasuser.flightattendants (rename=(empid=empnum)) nobs=num point=i; if empid=empnum then output; end; run;