BookmarkSubscribeRSS Feed
JUN_Sands
Fluorite | Level 6

Hi All,

I have multiple datasets with various number of variables in each dataset and I am trying to transpose them with using one code of loop.

For example, this is what I have got.

SourceLocation256
aaaa
bbbb
cccc

sourcelocation234
abbb

bbbb
caaa

sourceLocation137
accc
baaa
cbbb

............

And I am trying to use VAR _ALL_; but it made source and location columns as variables.

Proc Transpose data=work.comparison_want_&sas_name

out=work.comparison_want_t_&sas_name

name=Location

Label=Search_Engine
Prefix=Ranking;

by Source Location;

var _ALL_;

Run;

New Table from the first table would be like this..

SourceLocationNumbers_ListRanking
aaaa2
aaaa5
aaaa6
bbbb4
bbbb

5

bbbb6
cccc2
cccc5
cccc6

Please pardon my poor explanation... Anyone has an idea ?

Thanks!!

3 REPLIES 3
Steelers_In_DC
Barite | Level 11

It would be helpful to give an example dataset for what you have and the result you are looking for.

JUN_Sands
Fluorite | Level 6

Please see revised question. Desired output has been added. Thanks.

TomKari
Onyx | Level 15

If your other columns are numeric, just leave out the VAR statement; the procedure will use all of the variables not named in BY.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1998 views
  • 0 likes
  • 3 in conversation