Hi,
I'm having two data files of two months. One is july and august.
Using proc sql I combines these two data sets
select * from
( select depnto,
comm
from emp_aug13)
union all
( select depnto,
comm
from emp_Jun13);
I got output
deptno Comm
10 1000
20 3000
30 1500
10 500
20 190
30 250
Loking for output ,
Aug Jul
deptno Comm deptno Comm
10 1000 10 500
20 3000 20 190
30 1500 30 250
Can any one share me hints to achive this.
regards,
venky
an example:
data one;
input id var;
cards;
1 20
2 30
3 40
;
data two;
input id var;
cards;
1 200
2 300
3 400
;
proc sql;
select one.*,two.*
from one,two
where one.id=two.id;
quit;
id var id var
1 20 1 200
2 30 2 300
3 40 3 400
an example:
data one;
input id var;
cards;
1 20
2 30
3 40
;
data two;
input id var;
cards;
1 200
2 300
3 400
;
proc sql;
select one.*,two.*
from one,two
where one.id=two.id;
quit;
id var id var
1 20 1 200
2 30 2 300
3 40 3 400
Your desired output looks like a report, not a stored data set.
Take a look at PROC REPORT, potentially PROC TABULATE.
use 'comm' variable as commAug ,commJun in any in the data. you can not keep two variables on the same name.
Else use proc report
proc sql;
select emp_aug13.*,emp_Jun13.*
from emp_aug13,emp_Jun13
where emp_aug13.depnto=emp_Jun13.depnto;
quit;
deptno commAug commJun
10 1000 500
20 3000 190
30 1500 250
Thank you for the help. I got the output as you suggested me.
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.
Find more tutorials on the SAS Users YouTube channel.