Hi,
I'm having a little difficulty and would really appreciate help:
data have;
input State $ District $ Event $ Subject $ Status $ Date ;
format date date9.;
datalines;
UT 01-001 3_Month Health Complete 23000
UT 01-001 3_Month Math Complete 23000
UT 01-001 3_Month Science Complete 23000
NV 01-002 3_Month Health Complete 23001
NV 01-002 3_Month Science Complete 23002
NV 01-002 3_Month Math Incomp 23003
NV 01-002 6_Month Health Complete 23001
NV 01-002 6_Month Math Complete 23002
NV 01-002 6_Month Science Incomp 23003
;
run;
State | District | Event | Subject | Status | Date |
UT | 01-001 | 3_Month | Health | Complete | 21-Dec-22 |
UT | 01-001 | 3_Month | Math | Complete | 21-Dec-22 |
UT | 01-001 | 3_Month | Science | Complete | 21-Dec-22 |
NV | 01-002 | 3_Month | Health | Complete | 22-Dec-22 |
NV | 01-002 | 3_Month | Science | Complete | 23-Dec-22 |
NV | 01-002 | 3_Month | Math | Incomp | 24-Dec-22 |
NV | 01-002 | 6_Month | Health | Complete | 22-Dec-22 |
NV | 01-002 | 6_Month | Math | Complete | 23-Dec-22 |
NV | 01-002 | 6_Month | Science | Incomp | 24-Dec-22 |
This is what I'm trying to get for my final output:
State | District | Event | Health | Math | Science | HealthDate | MathDate | ScienceDate |
UT | 01-001 | 3_Month | Complete | Complete | Complete | 21-Dec-22 | 21-Dec-22 | 21-Dec-22 |
NV | 01-002 | 3_Month | Complete | Incomp | Complete | 22-Dec-22 | 24-Dec-22 | 23-Dec-22 |
NV | 01-002 | 6_Month | Complete | Complete | Incomp | 22-Dec-22 | 23-Dec-22 | 23-Dec-22 |
Your help is truly appreciated!
Are you trying to make a report that looks like the second table you show us?
If so, PROC REPORT is the tool to use, not PROC TRANSPOSE. (See Maxim 14)
proc report data=have;
columns state district event subject,status subject,date;
define state/group;
define district/group;
define event/group;
define subject/across;
define date/sum format=date11.;
run;
Are you trying to make a report that looks like the second table you show us?
If so, PROC REPORT is the tool to use, not PROC TRANSPOSE. (See Maxim 14)
proc report data=have;
columns state district event subject,status subject,date;
define state/group;
define district/group;
define event/group;
define subject/across;
define date/sum format=date11.;
run;
thank you
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.