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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: