BookmarkSubscribeRSS Feed
aarony
Obsidian | Level 7

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

2 REPLIES 2
stat_sas
Ammonite | Level 13

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;

Ksharp
Super User

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 413 views
  • 0 likes
  • 3 in conversation