Hi there I'm having issues trying to identify the minimum value of date of dispensation for each drug in the data set. Here's a sample data set and I've also attached a PDF copy to make it easier to read.
Rcpt_Anon_ID str8 DRUG_DIN double DSPN_AMT_QTY long DSPN_DATE double DSPN_DAY_SUPPLY_QTY str10 Prscb_Anon_ID str8 SUPP_DRUG_ATC_CODE
"000009106" "02261731" 3 18169 84 "390203576" "G03AA12"
"000009106" "02405628" 90 19971 90 "531829076" "C10AA07"
"000009106" "02353377" 180 19031 90 "277246846" "A10BA02"
"000009106" "02282445" 30 19400 30 "277246846" "N05CF01"
"000009106" "02405628" 90 20765 90 "277246846" "C10AA07"
"000009106" "02353377" 180 19838 90 "130332376" "A10BA02"
"000009106" "02405628" 90 21186 90 "385893456" "C10AA07"
"000009106" "02282445" 90 20974 90 "277246846" "N05CF01"
"000009106" "02353377" 180 19115 90 "277246846" "A10BA02"
.
Here's the code I ran to try and get a minimum date value for this data set
g opioid=substr(SUPP_DRUG_ATC_CODE,1,4)=="N02A"
. by Rcpt_Anon_ID: egen o_date = min(opioid) if opioid ==1
. format o_date %tdD_m_Y
. display o_date
after running the date, I'm not getting any values in return.
Any help would be great, thank you
Related Posts with Issues with getting minimum date value in a data set
Latent Class Model: problem with choosing the number of classesDear Specialists, I have tried the lclogit2 for each class (2,3 and 4), I could receive results fro…
Oprobit dependent variables only categorical?Dear all, I am not that familiar with ordered probit regression. Please, tell me, should all depende…
How to create a identifiers in Stata?I have around 40,000 obs in my dataset and I wish to club 1-10 obs as code 1, 11-20 as code 2.. so o…
categorize a variable if certain words are found in it from a big listHi everyone, I want to categorize a variable based on a list that I have maintained. This list is c…
How to make a binary outcome variable of 3 other variablesHi all, My outcome variable is Entrepreneur =Yes=1 and Entrepreneur = No=wageworker=0 I'm using GEM…
Subscribe to:
Post Comments (Atom)
0 Response to Issues with getting minimum date value in a data set
Post a Comment