/* 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
*/
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.