BookmarkSubscribeRSS Feed
JUN_Sands
Calcite | Level 5

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
Calcite | Level 5

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.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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