Hi everyone, I have these two datasets:
data have1;
input week $ ord count;
datalines;
week1 1 2
week2 1 3
week3 1 4
week4 1 3
week5 1 5
;
run;
data have2;
input week $ ord count;
datalines;
week1 2 1
week3 2 3
week4 2 4
;
run;
I want to obtain the final dataset (you can see, I want to keep the same structure in ord=2 that I have for ord=1):
week1 2 1
week2 3 1
week3 4 1
week4 3 1
week5 5 1
week1 1 2
week2 0 2
week3 3 2
week4 4 2
week5
I think CLASSDATA would do this job, but I do not remember How to apply to this particular problem.
Thank you.
V.
I just remembered it from data_null in other conversation
*creating classdata;
data classdata;
set have1 (keep=week);
run;
*creating my final dataset;
data have3;
set have1 have2;
by ord;
run;
*data_null code structure from other problem;
proc summary nway data=have3 classdata=classdata order=data;
by ord;
class week;
output out=want(drop=_freq_ _type_) idgroup(out(count)=);
run;
sorry week5 0 2 is the last record
I just remembered it from data_null in other conversation
*creating classdata;
data classdata;
set have1 (keep=week);
run;
*creating my final dataset;
data have3;
set have1 have2;
by ord;
run;
*data_null code structure from other problem;
proc summary nway data=have3 classdata=classdata order=data;
by ord;
class week;
output out=want(drop=_freq_ _type_) idgroup(out(count)=);
run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.