Hi everyone.
My data looks something like this:
Location Count1 Count2 Count3
1 12 7
2 10 13 2
3 5
4 8 12 15
And I want the data to look like this:
Location Count
1 12
2 10
3 5
4 8
2 13
4 12
1 7
2 2
4 15
Thanks for your help.
HI @yoyong555
data have;
input Location Count1 Count2 Count3;
cards;
1 12 . 7
2 10 13 2
3 5 . .
4 8 12 15
;
proc transpose data=have out=temp(where=(col1 ne .));
by location;
run;
proc sort data =temp out=want(drop=_name_);
by _name_;
run;
Hi @yoyong555 I think you are refering to DATA HAVE step. That was just to create a sample and yes you would have to indicate with a . for missing values especially when you are trying to read raw data using LIST input . But as long as your sample is a representative one of your real, do not be concerned about that.
You just need to focus on
proc transpose data=have out=temp(where=(col1 ne .));
by location;
var count:;
run;
proc sort data =temp out=want(drop=_name_);
by _name_;
run;
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.