05-26-2015 03:17 PM
I'm fairly new to SAS but was wondering if there is a way to delete observations by frequency count? For example, I used proc freq to generate a count of all diagnosis codes but all frequency counts<=5, I want to remove from the dataset. Is this possible?
05-26-2015 03:37 PM
There's going to be a lot of different ways to get this result. One way is to use the out= statement in your proc freq. This will get you a dataset with the result that you can manipulate anyway you want:
proc freq data= have;table variable /out=want;
05-26-2015 03:45 PM
I have over 500,000 observations in this dataset.
I already have my data filtered for the columns I need but for the diagnosis column, I ran a proc freq.
My Proc Freq data looks like:
I want to suppress or result any diagnosis code that has a frequency count <=5 with Blank or '.'
I am thinking about creating a data step and using IF-THEN statements to accomplish this task but it will be very time consuming.
05-26-2015 03:46 PM
proc freq might not be the best tool for data management. I would use proc SQL :
create table want as
select * from have
group by diagnosisCode
having count(*) > 5;