Hi Reader,
Could you please help me out with below mentioned query.
Here I have attched a output for your reference.
data want;
INFILE CARDS MISSOVER ;
input Name $ seq $ TR $ VER $ col1 $ col2 $ col3 $ col4 $ col5 $ col6 $ col7 $ col8 $ col9 $ col10 $ col11$;
cards;
Rohan 10 abc xyz G02CC C01EB D11AH D10AX M02AA R02AX
rohan 20 abc xyz N03AX N07XX
Devid 30 abc xyz
John 40 abc xyz B03AB B03AC V91 B03A V03AE
John 40 abc xyz B03AB B03AC V91 B03A V03AE B03AB B03AC V91 B03A V03AE
;
run;
proc sort data=want ;
by seq tr ver col1-col11;
run;
Thank you.
Regards
Priya
data have;
INFILE CARDS MISSOVER ;
input Name $ seq $ TR $ VER $ col1 $ col2 $ col3 $ col4 $ col5 $ col6 $ col7 $ col8 $ col9 $ col10 $ col11$;
cards;
Rohan 10 abc xyz G02CC C01EB D11AH D10AX M02AA R02AX
rohan 20 abc xyz N03AX N07XX
Devid 30 abc xyz
John 40 abc xyz B03AB B03AC V91 B03A V03AE
John 40 abc xyz B03AB B03AC V91 B03A V03AE B03AB B03AC V91 B03A V03AE
;
run;
data want;
set have;
array t seq tr ver col:;
do over t;
if t=' ' then leave;
q1=vname(t);
q2=t;
output;
end;
keep name q:;
run;
data have;
INFILE CARDS MISSOVER ;
input Name $ seq $ TR $ VER $ col1 $ col2 $ col3 $ col4 $ col5 $ col6 $ col7 $ col8 $ col9 $ col10 $ col11$;
cards;
Rohan 10 abc xyz G02CC C01EB D11AH D10AX M02AA R02AX
rohan 20 abc xyz N03AX N07XX
Devid 30 abc xyz
John 40 abc xyz B03AB B03AC V91 B03A V03AE
John 40 abc xyz B03AB B03AC V91 B03A V03AE B03AB B03AC V91 B03A V03AE
;
run;
data want;
set have;
array t seq tr ver col:;
do over t;
if t=' ' then leave;
q1=vname(t);
q2=t;
output;
end;
keep name q:;
run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.