BookmarkSubscribeRSS Feed
lupefine
Calcite | Level 5

Ok, bare with me here, I have only been using SAS for 2 weeks, so I realise some of my sentences will sound like soeone tying to learn a new language.

But here goes.

I have gathered data from our kennel club, one data set containing veterinary information (if the dog has a specific disease (PL= patellar luxation), and in that case, which degree, 0-3), and another 14 for each one of 14 breeds, containing names, registration numbers, lineage ect ect. I ended up with a dataset contaiing 250 000 observations, divided into 14 variables.

I have merged these files by breed code, registratio number, birth date and sex.

I have done some other ifs and formats to get what I want. So far so good.

I proceeded to see how many examinations were done by each veterinarian (variable called clinic). Also I wanted to see the frequencies of degrees (variable = degree) between each veterinarian.

So I wrote the following;

Proc sort data=plallbreeds;

by clinic degree;

PROC FREQ Data=plallbreeds ORDER=FREQ;

Tables Degree;

By Clinic;

Title 'bla bla bla';

Run;

And again, so far so good! Only problems is now that I have 390 veterinarians in my end result, and many of these have done less then 10 exams.

I would like to be able to exclude these from my output so I can better overview the result.

I have searched and searched but I just cant get the code right to do this.

Can someone here help me?

2 REPLIES 2
LinusH
Tourmaline | Level 20

If you just want the basic frequency count, you could use SQL:

proc sql;

select clinic, degree, count(*) as Freq

from plallbreeds

group by clinic, degree

order by clinic, degree;

quit;

Data never sleeps
Astounding
PROC Star

If you are happy with what you have so far, except that you want to eliminate the low counts, here is a way to modify the approach.  Instead of printing the report with PROC FREQ, create a data set holding the results.  The modification would be:

tables degree / noprint out=clinic_counts;

Then use PROC PRINT to print selected observations.  For example:

proc print data=clinic_counts;

  where count >= 10;

   *by, var, title statements as appropriate;

run;

Good luck.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2099 views
  • 0 likes
  • 3 in conversation