DATA Step, Macro, Functions and more

Descriptive Statistics issues

Reply
Occasional Contributor
Posts: 10

Descriptive Statistics issues

Hello Everyone here. It's my first day to show up here with a problem.
I have made some deciles (10 groups) into my data using following procedures;

proc rank data=mydata.descriptive out=results group=10 ties=low;
by year month;
var CR;
ranks CRRank;
run;

 

Next i calculated their median values by follwoing codes:

proc summary median data=results;
var BM Prc ;
by CRRANK;
output out=Desc n=ht_n median=ht_median std=ht_sd; run;

 

Problem;

 I wanna calculate these median for var = BM and PRC for next period (t+1). I have year and month variables in my data and portfolios are made every month. so for portfolio made in january i want to calculate median of BM from its february value. and then i want to make mean of these median values in each group. may be using something like this.

 

proc summary mean data=results;
var BM Prc ;
by CRRANK;
output out=Desc n=ht_n mean=ht_median std=ht_sd; run;.

 

I will be grateful if you can make some suggestions.
Thanks a lot.

Super User
Posts: 19,770

Re: Descriptive Statistics issues

I'm not following your logic. Some sample data and expected output will help illustrate your problem. 

Occasional Contributor
Posts: 10

Re: Descriptive Statistics issues

Yes unfortunately its hard to follow because of my bad instructions.
I have no idea how to put data here its really big in many GB.
I thought about another thing. Creating one month lead of my variables (BM Prc). Deciles  are already there. I can make median of that.
by using following codes.
proc summary median data=results;
var BM Prc ;
by CRRANK;
output out=Desc n=ht_n median=ht_median std=ht_sd; run;
now I have only one issue left. how can I take mean of all these medians in each group ? for each variable (BM, PRC)?
proc means;
var BM PRC;
BY CRRANK; run;
The issue is I donot know how can I export above median results into one sas table with lead values. so that I can use these codes to get mean.
does this make any sense?
Thanks for your help

Super User
Posts: 19,770

Re: Descriptive Statistics issues

Look at Proc expand. We don't need actual data, sample data that reflects your situation. 

Ask a Question
Discussion stats
  • 3 replies
  • 172 views
  • 0 likes
  • 2 in conversation