data original;
input DETAILS $ TYPE $ DIS $ SE_EMG $ SU_EMG $ group;
datalines;
1 THREATS jal Agri Crops 4
3 OPPORTUNITIES jal Agri Crops 5
2 THREATS jal Agri Crops 5
4 OPPORTUNITIES jal Agri Crops 6
6 WEAKNESS jal Agri Crops 6
5 OPPORTUNITIES jal Agri Crops 7
10 STRENGTHS jal Agri Crops 7
7 WEAKNESS jal Agri Crops 7
11 STRENGTHS jal Agri Crops 8
8 WEAKNESS jal Agri Crops 8
12 STRENGTHS jal Agri Crops 9
9 WEAKNESS jal Agri Crops 9
13 STRENGTHS jal Agri Crops 10
14 STRENGTHS jal Agri Crops 11
15 STRENGTHS jal Agri Crops 12
;
run;
proc sort data=original;
by group;
run;
proc transpose data=original out=transposed;
by group;
id type;
var DETAILS;
run;
i want
group | SE_EMG | SU_EMG | DIS | THREATS | OPPORTUNITIES | WEAKNESS | STRENGTHS |
4 | Agri | Crops | Jal | 1 | 3 | 6 | 10 |
5 | Agri | Crops | Jal | 2 | 4 | 7 | 11 |
6 | Agri | Crops | Jal | 5 | 8 | 12 | |
7 | Agri | Crops | Jal | 9 | 13 | ||
8 | Agri | Crops | Jal | 14 | |||
9 | Agri | Crops | Jal | 15 | |||
10 | Agri | Crops | Jal | ||||
11 | Agri | Crops | Jal | ||||
12 | Agri | Crops | Jal |
Please explain this. For group 4 (or any group), where do the numbers under THREATS, OPPORTUNITIES, WEAKNESS and STRENGTHS come from?
Make the additional variables part of the BY in both procedures.
If this is for reporting, consider PROC REPORT.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.