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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: