BookmarkSubscribeRSS Feed
tchapwavanelle
Calcite | Level 5

You are given 3 existing SAS data sets: Patient Demographic, Prescription, and Medical.
Patient Demographic Variables:
patient_id [numeric]
sex {‘M’,’F’,’U’}
race {0,1,2,3,4,5}
birthdt [character (8) mmddyyyy format]

Prescription Variables:

patient_id [numeric]
fill_dt [character (6) yymmdd format]
pharmacyid [numeric]
drugcode [numeric]
pills [numeric]

Medical Variables:

patientid [numeric]
servicedate [character (6) yymmdd format],
providerid [numeric]
source [character (3) format ‘aaa’]
servicecode [character (5) format ‘annnn’]
diagnosiscode1 [character (3) format ‘nnn’]
diagnosiscode2 [character (3) format ‘nnn’]
diagnosiscode3 [character (3) format ‘nnn’]

 

I was given the above code and requested to 

-- Generate a report on the proportion of: patients on any drug, patients with any physician visit, and patients
on any drug or with any physician visit.
 Report the distribution of: # of physician visits per patient, # of patients per drugcode, # of patients per
diagnostic grouping, and # of prescriptions per drugcode.

 

please I need help. While searching I saw I have to calculate binomial proportion with proc freq. am I on the right track? or do proc power?

3 REPLIES 3
ballardw
Super User

Since proc power is for estimating needed sample sizes given a specific type of test and some assumptions about distributions of values I suggest that you stop thinking about it as much of an analysis of "proportions".

 

You have several tasks, one is going to be combining data by common values (Patient_id but it appears that one of the sets may have that spelled differently). The proper approach to do such depends on content. And with no example provided that is pretty hard to guess correctly. SAS data step MERGE may work if Patient_id is not duplicated in two multiple sets. Otherwise Proc SQL to join data.

 

After combining data, if you want binomial proportions then you would be creating binomial values. That would typically mean variables that have 1 when a condition is true and 0 when false. Which is often done in data step.

 

Data want;
   set have;
   if drugcode= <some value no idea what it would be> then PatientWithDrug=1;
   else PatientWithDrug=0;
   If <which ever variable contains physician visit information> = <who knows what indicates a visit> then PatientWithVisit=1;
   else PatientWithVisit=0;
/*continue with conditions*/
run;

Caution: for some proportions you may not actually want missing values counted. That is your business rule/knowledge to know when. In which case you may need to test for MISSING values first.

 

Which SAS tools have they taught you to use as this seems like homework?

 

Without knowing how to tell membership in "diagnostic grouping" can't help much.

 

tchapwavanelle
Calcite | Level 5
which datasets should I merge? Prescription, Patient Demographic, Medical.
I should use merge using proc sql, then proc format afterward
proc freq data = X
tables patient_id / binomial (p=0.07);
run; is this a correct way?
ballardw
Super User

Without seeing actual data I won't recommend a method of joining data as the choice depends on content.

Your required analysis tells you what pieces need to be in the same data set.

 

Proc Format creates formats and informats. So I am not sure what you are asking though it could be used when READING data to create binary values.

 

What happens when you run that proc freq on data?

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!
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
  • 3 replies
  • 479 views
  • 0 likes
  • 2 in conversation