I am trying to subset data based on the frequency of a given value within a variable. I've attached a screen shot of a proc freq table, and essentially I would like to include all CCIDummy values where row percent UpdtxStatus 'yes' >/=5%.
I tried the following code, but the '%' results in a syntax error:
proc sql;
create table TEST as
select *
from work.CombiningProceduresDummyVariable
group by CCIdummy
having (UpdtxStatus='yes')ge 5%;
quit;
Thanks in advance!
You are right, I edited 2 secs before yours came through. Good catch!
Hi @bretthouston I think you may be looking to do this
proc sql;
create table TEST as
select *
from work.CombiningProceduresDummyVariable
group by CCIdummy
having sum(UpdtxStatus='yes')/n(CCIdummy) ge .05;
quit;
You are right, I edited 2 secs before yours came through. Good catch!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.