***********************************************************; * Research Computing Services *; * Introduction to SAS *; ***********************************************************; ***********************************************************; * SAS Means procedure *; * *; * 1. Execute the code as is and explore the output *; * for each mean procedure *; * 2. Modify the condition to filter the data and *; * examine the output *; * *; ***********************************************************; * Read more: ; * means: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0f0fjpjeuco4gn1ri963f683mi4.htm *; * https://www.sas.com/content/dam/SAS/en_ca/User%20Group%20Presentations/Vancouver-User-Group/JasonShurgold-ProcMeans-Nov2014.pdf *; /* Include sas program that sets input library */ %include "setup.sas"; /* brief summaries for numeric columns */ proc means data=mydata.med_visits; title "Summaries for Age, Height, DBP and SBP variables"; var Age Height DBP SBP; run; /* brief summaries for numeric columns */ proc means data=mydata.med_visits; title "Summaries for Age, Height, DBP and SBP variables"; var Age Height DBP SBP; run; /* use class to group by a categorical variable */ proc means data=mydata.med_visits; title "Summaries for SBP and DBP variables grouped by Sex"; var DBP SBP; class Sex; run; /* use where to filter observations */ proc means data=mydata.med_visits; title "Summaries for SBP and DBP variables grouped by Sex for Age > 50"; var DBP SBP; class Sex; where Age > 50; run; /* use by to split output into 2 separate tables - this requires that the data is sorted by this variable first*/ proc sort data=mydata.med_visits; by Sex; run; proc means data=mydata.med_visits; title "Summaries for SBP and DBP variables split Sex"; var DBP SBP; by Sex; run;