BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sophia_SAS
Obsidian | Level 7

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!

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

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

3 REPLIES 3
Linlin
Lapis Lazuli | Level 10

example:

proc freq data =sashelp.class noprint;

  tables sex  / out=temp ;

  run;

data want;

  set temp;

  if count>9;

run;

art297
Opal | Level 21

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;

Linlin
Lapis Lazuli | Level 10

Thank you Art!  - Linlin

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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