BookmarkSubscribeRSS Feed
AMMAN
Obsidian | Level 7

Hi - I have a dataset where each record is a count of how many times a physician prescribed a certain drug.  I would like to calculate how many times each physician prescribed opioids and nonopioids so that I can classify the physician as a "high subscriber" if the count of opioids is over a certain number.  

 

Does anyone have any advice on how I can approach this problem?

 

Thanks

AMT

10 REPLIES 10
PaigeMiller
Diamond | Level 26

You (or someone) has to classify each drug prescribed as either opioid or non-opioid. Then PROC FREQ will count the number of times each physician prescribes opioid or non-opioid.

 

... so that I can classify the physician as a "high subscriber" if the count of opioids is over a certain number.  

 

Shouldn't that say: if the percent of opioids is over some pre-determined percent?

--
Paige Miller
AMMAN
Obsidian | Level 7

I have the drugs specified as either opioid or nonopioid.  PROC FREQ gives me the variables individually.  I want FREQ by provider

 

Angie 

Reeza
Super User
Well, show your PROC FREQ or data. You likely just did your PROC FREQ wrong. Did you do it by Provider and Opioid variable?
AMMAN
Obsidian | Level 7

I am using SAS for Academics.  Everytime I run this, I get an error that SAS needs to close.

 

PROC FREQ DATA=WORK

tables npi*class;

run;

 

This is a subset of the data.  I could not load the entire file as it is too large.

Patrick
Opal | Level 21

@AMMAN 

If we only get partial information then it's a bit hard to really know where things don't work for you.

Have you already read these guidelines here?

 

For the code you've just posted: Looks like there is a semicolon missing after the Proc part of the statement.

PROC FREQ DATA=WORK.want;
  tables npi*class;
run;
PaigeMiller
Diamond | Level 26

@AMMAN wrote:

I am using SAS for Academics.  Everytime I run this, I get an error that SAS needs to close.

 

PROC FREQ DATA=WORK

tables npi*class;

run;

 

This is a subset of the data.  I could not load the entire file as it is too large.


What is in the Excel file is irrelevant here. One of the things that you can do is to actually look at the SAS data set WORK (not the Excel file) and see if you can find something wrong; or if it looks okay. If something looks wrong and you can't figure out how to fix it, then we need to see a portion of the SAS data set (following these instructions) and not the original Excel file.

 

(And as @Patrick said, make sure you fix obvious errors in your code before coming here to ask further questions, such as fixing the missing semi-colon issue he mentions)

--
Paige Miller
AMMAN
Obsidian | Level 7

You're quick to assume the missing semi-colon wasn't an innocent mistake.  I keyed the code in the chat box quickly because my cut and paste from EG was lost when I tried to attach the full file which caused an error.  

 

This is a beginner's forum.  You could try to be friendly.  

PGStats
Opal | Level 21

I can assure you that we all try to be friendly. But please try to understand our suggestions. Our only goal is to help you solve your problem.

PG
Reeza
Super User
How big is your data? Assuming you’re using the cloud service, Academics on Demand and not running locally, there are size limits to what you can upload and use on the site. If you’re affiliated with an academic institution you can usually get a full desktop license for a low cost (around $100).
ballardw
Super User

@AMMAN wrote:

I am using SAS for Academics.  Everytime I run this, I get an error that SAS needs to close.

 

PROC FREQ DATA=WORK

tables npi*class;

run;

 

This is a subset of the data.  I could not load the entire file as it is too large.


If you intended to use a count variable, such as your bene_count to indicate the number of times that provide did something you would use that variable on a WEIGHT statement. Otherwise each of those records only gets counted for one prescription.

 

One thing you might try is to add NOPRINT to the proc statement as the table output in the results could be excessive.

PROC FREQ DATA=WORK noprint;
tables npi*class / out=work.freq (drop=percent);
weight bene_count;
run;

I think that I might be tempted to include a row percentage. Consider if you pick 700 as your "count" of opioids to be "high"?

If you have one provider with 500 prescriptions and 490 of them are opioids you wouldn't see that one as "high" but another provider with 100,000 total prescriptions and 701 would be. The first having 98 percent opioids wouldn't meet the threshold but the other with 0.7 percent would. So I might consider a percentage of opioid prescriptions coupled with a minimum number of total prescriptions.

Something like:

PROC FREQ DATA=WORK noprint;
tables npi*class / outpct out=work.freq (drop=percent  pct_col);
weight bene_count;
run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 10 replies
  • 1059 views
  • 3 likes
  • 6 in conversation