Can I limit my PROC FREQ result to groups where there are more than 30 observations in the below code? In other words, I would like to just report the number of observations in SUV, Sedan, and Sports groups, respectively, using PROC FREQ. In general, I would like to know how I can add a condition to limit my result.
proc freq data= sashelp.cars;
table type/ nopercent nocol; run;
Type Frequency Cumulative
FrequencyHybrid 3 3 SUV 60 63 Sedan 262 325 Sports 49 374 Truck 24 398 Wagon 30 428
Not Sure directly on a PRINT output, but a workaround could be the following
ods output OneWayFreqs=want(where=(Frequency>30));
proc freq data= sashelp.cars ;
table type/ nopercent nocol; run;
proc print noobs;run;
And what should appear in the Cumulative Frequency column?
If you don't need to worry about cumulative frequency, PROC FREQ can output the right numbers directly into a data set:
proc freq data= sashelp.cars;
table type / noprint out=want (where=(count > 30));
run;
proc print data=want label;
label count = 'Frequency';
var type count;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.