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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.