Data LBCFin;
Input ALIAS2 DRAWN_DT_TM CE_EVENT_DISP $ RESULT_VAL $;
Datalines;
9023665 09/09/19 Tramadol Negative
9023665 09/09/19 Oxymorphone Negative
9023665 09/09/19 Oxycodone Negative
9023665 09/09/19 Norfentanyl Positive
9023665 09/09/19 Morphine Negative
539151 09/10/19 Tramadol Negative
539151 09/10/19 Oxymorphone Negative
539151 09/10/19 Oxycodone Negative
539151 09/10/19 Norfentanyl Positive
539151 09/10/19 Morphine Negative
30000180858 09/06/19 Tramadol Negative
30000180858 09/06/19 Oxymorphone Positive
30000180858 09/06/19 Oxycodone Negative
30000180858 09/06/19 Norfentanyl Positive
30000180858 09/06/19 Morphine Positive
9146000 09/09/19 Tramadol Negative
9146000 09/09/19 Oxymorphone Negative
9146000 09/09/19 Oxycodone Negative
9146000 09/09/19 Norfentanyl Positive
9146000 09/09/19 Morphine Negative
10009041914 08/03/19 Tramadol Negative
10009041914 08/03/19 Oxymorphone Negative
10009041914 08/03/19 Oxycodone Negative
10009041914 08/03/19 Norfentanyl Positive
10009041914 08/03/19 Morphine Negative
10007219967 08/20/19 Tramadol Negative
10007219967 08/20/19 Oxymorphone Negative
10007219967 08/20/19 Oxycodone Negative
10007219967 08/20/19 Norfentanyl Positive
9300271 08/27/19 Tramadol Negative
9300271 08/27/19 Oxymorphone Negative
9300271 08/27/19 Oxycodone Negative
9300271 08/27/19 Norfentanyl Positive
9300271 08/27/19 Morphine Negative
10008038267 08/16/19 Tramadol Positive
10008038267 08/16/19 Oxymorphone Negative
10008038267 08/16/19 Oxycodone Negative
10008038267 08/16/19 Norfentanyl Positive
10008038267 08/16/19 Morphine Negative
70000381170 08/13/19 Tramadol Negative
70000381170 08/13/19 Oxymorphone Negative
70000381170 08/13/19 Oxycodone Negative
70000381170 08/13/19 Norfentanyl Positive
70000381170 08/13/19 Morphine Negative
10009130527 08/10/19 Tramadol Negative
10009130527 08/10/19 Oxymorphone Negative
10009130527 08/10/19 Oxycodone Negative
10009130527 08/10/19 Norfentanyl Positive
10009130527 08/10/19 Morphine Negative
10014965503 08/13/19 Tramadol Negative
10014965503 08/13/19 Oxymorphone Negative
10014965503 08/13/19 Oxycodone Negative
10014965503 08/13/19 Norfentanyl Positive
10014965503 08/13/19 Morphine Negative
30000464968 08/15/19 Tramadol Positive
30000464968 08/15/19 Oxymorphone Negative
30000464968 08/15/19 Oxycodone Positive
30000464968 08/15/19 Norfentanyl Negative
30000464968 08/15/19 Morphine Positive
70000381444 08/14/19 Tramadol Negative
70000381444 08/14/19 Oxymorphone Negative
70000381444 08/14/19 Oxycodone Negative
70000381444 08/14/19 Norfentanyl Positive
70000381444 08/14/19 Morphine Negative
70000380987 08/12/19 Tramadol Negative
70000380987 08/12/19 Oxymorphone Negative
70000380987 08/12/19 Oxycodone Negative
70000380987 08/12/19 Norfentanyl Positive
70000380987 08/12/19 Morphine Positive
102686961 08/15/19 Tramadol Negative
102686961 08/15/19 Oxymorphone Negative
102686961 08/15/19 Oxycodone Negative
102686961 08/15/19 Norfentanyl Positive
102686961 08/15/19 Morphine Positive
102066046 08/15/19 Tramadol Negative
102066046 08/15/19 Oxymorphone Negative
102066046 08/15/19 Oxycodone Negative
102066046 08/15/19 Norfentanyl Negative
102066046 08/15/19 Morphine Negative
102664250 08/15/19 Tramadol Negative
102664250 08/15/19 Oxymorphone Negative
102664250 08/15/19 Oxycodone Negative
102664250 08/15/19 Norfentanyl Positive
102664250 08/15/19 Morphine Positive
105935989 08/17/19 Tramadol Negative
105935989 08/17/19 Oxymorphone Negative
105935989 08/17/19 Oxycodone Negative
105935989 08/17/19 Norfentanyl Negative
105935989 08/17/19 Morphine Negative
102098379 08/21/19 Tramadol Negative
102098379 08/21/19 Oxymorphone Negative
102098379 08/21/19 Oxycodone Negative
102098379 08/21/19 Norfentanyl Positive
102024174 08/22/19 Tramadol Negative
102024174 08/22/19 Oxymorphone Negative
102024174 08/22/19 Oxycodone Negative
102024174 08/22/19 Norfentanyl Positive
102024174 08/22/19 Morphine Negative
;
Run;
CODE:
OPTIONS COMPRESS = YES; options ls=70 ps=50 mergenoby=error; run;
/*proc format ; value $RESULT_VAL 'Positive' = '1' 'Negative' = '0'; run;*/
data LBCFin1; set LBCFin; /*format RESULT_VAL $RESULT_VAL.;*/ run;
* Printout;
proc print data = LBCFin1; run;
* Transpose Wide Steps;
proc sort tagsort data = LBCFin1; by ALIAS2 CE_EVENT_DISP DRAWN_DT_TM ACCESSION; run;
proc transpose data = LBCFin1 out = LBConFin; by ALIAS2 CE_EVENT_DISP DRAWN_DT_TM ACCESSION; var RESULT_VAL; run;
proc sort tagsort data = LBConFin; * ADDED THIS EXTRA PROC SORT, IT WORKED; by ALIAS2 DRAWN_DT_TM ACCESSION; run;
proc transpose data = LBConFin delimiter=_ out=LBCFin3 (drop=_name_); by ALIAS2 DRAWN_DT_TM ACCESSION; var col1; id CE_EVENT_DISP; run;
proc print data=LBCFin3; run;
Data LBCFin3; set LBCFin3; Format ALIAS2 30.; If ALIAS2=. then delete; Rename ALIAS2=MRN; ACCESS=substr(ACCESSION,10,9); run;
Data LBCFin4; Set LBCFin3; uniqueID = compress (MRN||DRAWN_DT_TM); run;
proc print data=LBCFin4; run;
... View more