multiple varibles in single observation

Reply
Frequent Contributor
Posts: 89

multiple varibles in single observation

Hai

  I have a dataset which contain 5 variables like day_1 , day_15 , day_30, day_90 and each variables contain data (observations). I need to get the table like this

DayNo of records
meanstdrange
Day 1xxxxxxxx
Day 15xxxxxxxx
Day 30xxxxxxxx
Day 90xxxxxxxx

Thanks

Krishna

Contributor
Posts: 45

Re: multiple varibles in single observation

Hi,

You can use PROC MEANS, right?

proc means data=have;           

var day_1 day_15 day_30 day_90; 

run;                            

Or is there any special requirement( like range in same column...... or any?)

Frequent Contributor
Posts: 89

Re: multiple varibles in single observation

Is any possible way to find the result using proc tabulate?

Super User
Posts: 11,134

Re: multiple varibles in single observation

proc tabulate data=have;

var day_1 day_15 day_30 day_90;

table day_1 day_15 day_30 day_90,

          n='No of records' mean std range;

run;

Frequent Contributor
Posts: 89

Re: multiple varibles in single observation

Thanks for your kind support 

Frequent Contributor
Posts: 89

Re: multiple varibles in single observation

I have a doubt in another topic.Please do help me

Frequent Contributor
Posts: 89

Re: multiple varibles in single observation

Thanks for your kind support 

Super User
Posts: 9,875

Re: multiple varibles in single observation

One thing need to remind. NULL's code need SAS9.3 to run .

Frequent Contributor
Posts: 89

Re: multiple varibles in single observation

I have a doubt in another topic.Please do help me

Super User
Posts: 9,875

Re: multiple varibles in single observation

Old school :

proc summary data=sashelp.class ;
var weight height;
output out=temp(drop=_:) n= mean= std= range= /autoname;
run;
proc transpose data=temp out=x;
var _all_;
run;
data x(drop=_name_);
 set x;
 name=scan(_name_,1,'_');
 stat=scan(_name_,-1,'_');
run;
proc sort data=x ;by name ;run;
proc transpose data=x out=want(drop=_:);
by name;
id stat;
var col1;
run;

Xia Keshan

Frequent Contributor
Posts: 89

Re: multiple varibles in single observation

Thanks for your kind support  Smiley Happy

Respected Advisor
Posts: 3,788

Re: multiple varibles in single observation

If you want the output in a SAS data set I think PROC MEANS STACKODS works well.

ods select none;
proc means data=sashelp.class stackods n mean std range;
  
ods output Summary=Summary;
   run;
ods select all;
9-11-2014 8-52-55 AM.png
proc print;
  
run;

Frequent Contributor
Posts: 89

Re: multiple varibles in single observation

Thanks for your kind support 

Ask a Question
Discussion stats
  • 12 replies
  • 508 views
  • 3 likes
  • 5 in conversation