BookmarkSubscribeRSS Feed
yogita_patel
Calcite | Level 5

I would like to transpose column sord only. here is the sample data below.

 

yogita_patel_0-1735081133089.png

I tried using ID statement. but other columns are also getting transpose.

3 REPLIES 3
PaigeMiller
Diamond | Level 26

I cannot imagine what this data set would look like if SORD is split into 2 columns but the other column stay as they are. Please show us.

 

Also, please take a step back and describe the real problem that this is related to, without reference to SAS or Excel or transforming this data. Most likely, your boss or professor wants you to solve a real problem, they didn't say transform this matrix, they asked you to solve a real problem. What is that real problem?

 

Also, we prefer data presented as working SAS data step code (examples and instructions). We can't really work with data in screen captures.

--
Paige Miller
Tom
Super User Tom
Super User

Not sure what you mean by transpose.

If you want to make another variable that has the same values as SORD then a simple assignment statement will work. 

data want;
  set have;
  sord2 = sord;
run;

But why?

Ksharp
Super User
That would be better if you post desired output.
If you just want split column sord into two columns ,that is easy:

data want;
set have;
if sord=1 then sord1=1;
if sord=2 then sord2=2;
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 643 views
  • 0 likes
  • 4 in conversation