BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MKhandelwal
Fluorite | Level 6

Hi all,

I have a SAS data set like below:

MoisorgNaCaMg
00.87751.6471.008451.10295
1000.711451.370250.762750.8316
2000.625051.205550.68580.7398
3300.55891.075950.627750.6885


And I want a new data set to be like this...

Mois_retTrtResponse
0org0.8775
0Na1.647
0Ca1.00845
0Mg1.10295
100org0.71145
100Na1.37025
100Ca0.76275
100Mg0.8316
200org0.62505
200Na1.20555
200Ca0.6858
200Mg0.7398
330org0.5589
330Na1.07595
330Ca0.62775
330Mg0.6885


Please tell me the solution.

With Best Regards,

Manoj Khandelwal

1 ACCEPTED SOLUTION

Accepted Solutions
barheat
Fluorite | Level 6

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

View solution in original post

3 REPLIES 3
barheat
Fluorite | Level 6

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

MKhandelwal
Fluorite | Level 6

Thanks barheat. It works.

data_null__
Jade | Level 19

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 980 views
  • 0 likes
  • 3 in conversation