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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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