1 standard deviation of from the mean, construct three portfolios.

Reply
Frequent Contributor
Posts: 102

1 standard deviation of from the mean, construct three portfolios.

I want to create three pfos for each year. my variable using to cut the observation is index1.

i want to use the mean and construct

pfo1: from the lowest number to mean - 1 std dev.

pfo 2: mean - 1 std dev to   mean - 1 std dev.

pfo 3: mean + 1 std dev to highest number

for each year.

i know how to obtain 1st and 99th percentile of the observations of each year

proc univariate data=pfo.merged_A1 noprint; var index1; by pfoyr;

output out=mean pctlpts=1 99 pctlpre=p; run;

i feel like i have to use something in that sort....

Many thx,

aaron

Trusted Advisor
Posts: 1,228

Re: 1 standard deviation of from the mean, construct three portfolios.

If you are okay with proc sql then you can try something like

proc sql;

create table want as

select  pfoyr,min(index1) - std(index1) as profile1,

       avg(index1) - std(index1) as profile2,

       avg(index1) + std(index1) as profile3

from pfo.merged_A1

group by pfoyr;

quit;

Super User
Posts: 9,867

Re: 1 standard deviation of from the mean, construct three portfolios.

If I understood what you mean.

data class;
 set sashelp.class;
run;
proc sort data=class;by sex;run;
proc summary data=class ;
by sex;
var weight;
output out=stat(drop=_:) mean=mean std=std;
run;
data want;
 merge class stat;
 by sex;
 select;
  when(weight(mean+std)) pfo=3;
  otherwise pfo=2;
end;
run;

Xia Keshan

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