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)
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.