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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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