Hi Team,
I have a sas table and in that table I have 20 columns and all 20 columns have certain values. And here I want to create another sas table from this table where I should two column. in one column I should have all column names of first sas table and in other table I want to store all the values respective to the column names.
first dataset:
DATA Abhi;
input a b c d e f g h i j k l m;
datalines;
---
---
--
;
outcome dataset result:
1st 2nd
a 5
a 4
a 3
b 2
b 6
c 8
d 9
e 10
f 11
g 12
h 13
;
thank!
Take a look at proc transpose and sort.
If you could post clear samples,lazy people like me would test the code for you
You should get that with :
data want;
set abhi;
array _a a--m;
do _i = 1 to dim(_a);
var = vname(_a{_i});
value = _a{_i};
if not missing(value) then output;
end;
keep var value;
run;
proc sort data=want; by var; run;
(untested)
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.