/* test data */
data one;
input id month :anydtdte7. invites;
format month monyy7.;
cards;
1 Jan2010 2
1 Feb2010 3
1 Mar2010 1
2 Jan2010 7
2 Feb2010 1
2 Mar2010 9
3 Jan2010 1
3 Mar2010 2
;
run;
proc format;
value idxf low--2="Below" -2<-<2="Meets" 2-high="Above";
run;
proc sql;
select one.*
, mean(invites) as meanInvites format=8.2
, putn(invites - calculated meanInvites,"idxf") as index
from one
group by month
order by id, month;
quit;
/* on lst
mean
id month invites Invites index
----------------------------------------------
1 JAN2010 2 3.33 Meets
1 FEB2010 3 2.00 Meets
1 MAR2010 1 4.00 Below
2 JAN2010 7 3.33 Above
2 FEB2010 1 2.00 Meets
2 MAR2010 9 4.00 Above
3 JAN2010 1 3.33 Below
3 MAR2010 2 4.00 Below
*/
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.