Hi,
1. I want to find observations with same MRN's and same visit_id. Then i want to add the MMEdispense for them.
Ultimately want to end up with one row for that observation.
2. I want to find observations with same MRN and different visit visit_id. if proc_start is within one year then delete them and if proc_start
is more than one year then keep them.
Thanks.
Part of my SAS dataset is attached.
Don't attach datasets. Post a data step with datalines.
Data red.opioid;
Input MRN VISIT_ID PROC_START MMEdispense;
Datalines;
1020331 48648679 22APR2014 75.0
1022198 52165183 17APR2018 225.0
1024630 49793399 19OCT2015 240.0
1024630 49793399 19OCT2015 480.0
1026419 50195990 10MAR2016 225.0
1029297 48962048 23SEP2014 225.0
1029297 49174787 08JAN2015 225.0
1029297 49384901 14APR2015 225.0
1029297 49765729 07OCT2015 300.0
1029297 50775972 01NOV2016 225.0
;
Run;
@Kyra Did you run that code? Did it work for you?
I think this works below:
Data opioid;
infile cards truncover;
informat mrn $8. visit_ID $8. proc_start date9. mmedispense best12.;
format proc_start yymmddd10.;
Input MRN VISIT_ID PROC_START MMEdispense;
Datalines;
1020331 48648679 22APR2014 75.0
1022198 52165183 17APR2018 225.0
1024630 49793399 19OCT2015 240.0
1024630 49793399 19OCT2015 480.0
1026419 50195990 10MAR2016 225.0
1029297 48962048 23SEP2014 225.0
1029297 49174787 08JAN2015 225.0
1029297 49384901 14APR2015 225.0
1029297 49765729 07OCT2015 300.0
1029297 50775972 01NOV2016 225.0
;
Run;
Hi,
i imported excel datasheet into SAS. Thus i did not need the data step with datalines.
Thanks,
prerna
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.