I misuploaded it to other forum so I moved my question to here.
I am trying to program a simple code.
Original data:
TableA
ID | Date | Type
1 20111111 A
2 20081014 C
3 20051126 A
...
100 20160421 B
From this original data, I want to pick up dates by Type.
Like following
Result (only picking up A & B)
ID | DateofA | DateofB
1 | 20111111 |
2 | |
3 | 20051126 |
...
100 | | 20160421
Are there anyone know how to program this?
Thank you in advance.
you might want to look at proc transpose here are two links to get you started
https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/
https://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000063663.htm
Is this what you are looking for ?
data have;
input ID $ Date Type $;
datalines;
1 20111111 A
2 20081014 C
3 20051126 A
100 20160421 B
;
run;
proc sort data=have;
by id;
where type in ('A','B');
run;
Proc transpose data=have out=want(drop=_name_ ) prefix=dateof;
id type;
by id;
var date;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.