Hi all,
I have a SAS data set like below:
Mois | org | Na | Ca | Mg |
0 | 0.8775 | 1.647 | 1.00845 | 1.10295 |
100 | 0.71145 | 1.37025 | 0.76275 | 0.8316 |
200 | 0.62505 | 1.20555 | 0.6858 | 0.7398 |
330 | 0.5589 | 1.07595 | 0.62775 | 0.6885 |
And I want a new data set to be like this...
Mois_ret | Trt | Response |
0 | org | 0.8775 |
0 | Na | 1.647 |
0 | Ca | 1.00845 |
0 | Mg | 1.10295 |
100 | org | 0.71145 |
100 | Na | 1.37025 |
100 | Ca | 0.76275 |
100 | Mg | 0.8316 |
200 | org | 0.62505 |
200 | Na | 1.20555 |
200 | Ca | 0.6858 |
200 | Mg | 0.7398 |
330 | org | 0.5589 |
330 | Na | 1.07595 |
330 | Ca | 0.62775 |
330 | Mg | 0.6885 |
Please tell me the solution.
With Best Regards,
Manoj Khandelwal
Simple solution is to use PROC TRANSPOSE
proc transpose data=chem out=chem2;
var org na ca mg;
by mois;
run;
Default column names will be mois, _NAME_ and COL1
Simple solution is to use PROC TRANSPOSE
proc transpose data=chem out=chem2;
var org na ca mg;
by mois;
run;
Default column names will be mois, _NAME_ and COL1
Thanks barheat. It works.
Default column names will be mois, _NAME_ and COL1
Use NAME= option and RENAME data set option'
proc transpose name=trt out=chem2(rename=(col1=response))
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.