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.
Source | Location | 2 | 5 | 6 |
---|---|---|---|---|
a | aaa | |||
b | bbb | |||
c | ccc |
source | location | 2 | 3 | 4 |
---|---|---|---|---|
a | bbb | |||
b | bbb | |||
c | aaa |
source | Location | 1 | 3 | 7 |
---|---|---|---|---|
a | ccc | |||
b | aaa | |||
c | bbb |
............
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..
Source | Location | Numbers_List | Ranking |
---|---|---|---|
a | aaa | 2 | |
a | aaa | 5 | |
a | aaa | 6 | |
b | bbb | 4 | |
b | bbb | 5 | |
b | bbb | 6 | |
c | ccc | 2 | |
c | ccc | 5 | |
c | ccc | 6 |
Please pardon my poor explanation... Anyone has an idea ?
Thanks!!
It would be helpful to give an example dataset for what you have and the result you are looking for.
Please see revised question. Desired output has been added. Thanks.
If your other columns are numeric, just leave out the VAR statement; the procedure will use all of the variables not named in BY.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.