Hi everyone,
I'm a STATA neophyte, but I've tried looking through the manual as well as browsing online forums to no avail so far, so I'm trying my luck here.
I have a dataset of drug prescriptions by practitioner and by health area that I need to analyse.
Specifically, I need to calculate the prescription rates (number of prescriptions per 100 people in each practitioner area, and in each health area) for drug A.
Here are the varlists:
practiceid (a unique identifier, string, which identifies each practitioner)
healtharea (a string naming a geographic area, to which multiple practitioners can belong to, but each practitioner can only belong to one area)
areapopsize (the number of patients in each practitioner's roster)
rxnumber (the number of prescriptions for a particular drug written by that practitioner)
drugname (this is pretty self-evident)
arx (this is essentially a boolean, =1 if the drugname=A, =0 if not)
So the prescription rates I need to figure out are: rate of prescription for drug A per areapopsize, and for drug A per healtharea
The nuance is that there could be multiple (non-duplicate) entries recording a practitioner to prescribing drug A (for example entries 1 and 3 below)
Also, there are multiple practitioners per health area (like 10106 and 10384 for Essex):
I'm thinking I need to first tally up the rxnumber where arx=1 for each unique practiceid, then divide this by the areapopsize to figure out the rate per areapopsize
Then I need to combine the rxnumber where arx=1 for each healtharea, and divide this by the total popsize of the healtharea (by tallying up the constituent areapopsizes)
But I honestly don't know what STATA code to use to do this.
Any help is appreciated.
Thanks in advance!
-Elle
I'm a STATA neophyte, but I've tried looking through the manual as well as browsing online forums to no avail so far, so I'm trying my luck here.
I have a dataset of drug prescriptions by practitioner and by health area that I need to analyse.
Specifically, I need to calculate the prescription rates (number of prescriptions per 100 people in each practitioner area, and in each health area) for drug A.
Here are the varlists:
practiceid (a unique identifier, string, which identifies each practitioner)
healtharea (a string naming a geographic area, to which multiple practitioners can belong to, but each practitioner can only belong to one area)
areapopsize (the number of patients in each practitioner's roster)
rxnumber (the number of prescriptions for a particular drug written by that practitioner)
drugname (this is pretty self-evident)
arx (this is essentially a boolean, =1 if the drugname=A, =0 if not)
So the prescription rates I need to figure out are: rate of prescription for drug A per areapopsize, and for drug A per healtharea
The nuance is that there could be multiple (non-duplicate) entries recording a practitioner to prescribing drug A (for example entries 1 and 3 below)
Also, there are multiple practitioners per health area (like 10106 and 10384 for Essex):
practiceid | healtharea | areapopsize | drugname | rxnumber | arx |
10106 | Essex | 6132 | A | 12 | 1 |
10106 | Essex | 6132 | C | 13 | 0 |
10106 | Essex | 6132 | A | 9 | 1 |
10384 | Essex | 3589 | A | 15 | 1 |
10384 | Essex | 3589 | B | 20 | 0 |
10563 | Kent | 1204 | A | 15 | 1 |
10909 | Lambton | 948 | C | 3 | 0 |
I'm thinking I need to first tally up the rxnumber where arx=1 for each unique practiceid, then divide this by the areapopsize to figure out the rate per areapopsize
Then I need to combine the rxnumber where arx=1 for each healtharea, and divide this by the total popsize of the healtharea (by tallying up the constituent areapopsizes)
But I honestly don't know what STATA code to use to do this.
Any help is appreciated.
Thanks in advance!
-Elle
Comment