Help using Base SAS procedures

frequencies

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 104
Accepted Solution

frequencies

Hi SAS community-

Below is a abbreviated version of an output from a proc freq.

ID         Frequency      Percent      and so on . . .

a          4                    0.40

b          2                    0.20

c          1                    0.10

d          1                    0.10

e          1                    0.10

f           1                    0.10

I would like to view only the IDs that have a frequency of 2 or more (therefore would exclude IDs 'c-f').

Please advise as to how I can do this procedure.


Thanks!


Accepted Solutions
Solution
‎03-27-2012 03:14 PM
PROC Star
Posts: 7,366

frequencies

Or, just use a where statement to eliminate the ids that don't meet your criterion.  e.g.:

proc freq data=have;

  tables id/out=want (where=(count ge 2));

run;

View solution in original post


All Replies
Super Contributor
Posts: 1,636

frequencies

example:

proc freq data =sashelp.class noprint;

  tables sex  / out=temp ;

  run;

data want;

  set temp;

  if count>9;

run;

Solution
‎03-27-2012 03:14 PM
PROC Star
Posts: 7,366

frequencies

Or, just use a where statement to eliminate the ids that don't meet your criterion.  e.g.:

proc freq data=have;

  tables id/out=want (where=(count ge 2));

run;

Super Contributor
Posts: 1,636

frequencies

Thank you Art!  - Linlin

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 286 views
  • 5 likes
  • 3 in conversation