Hi Team,
am looking for a solution for the situation like this
data have;
infile cards dlm=",";
input
Patient_ID : 8.
Admit_Date : anydtdtm.
Disch_Date : anydtdtm.
Facility_Type : $32.
;
format admit_date disch_date datetime19.;
cards;
12345,02JAN2014:00:00:00.000,05JAN2014:00:00:00.000,Nursing Home
12345,02JAN2014:00:00:00.000,07JAN2014:00:00:00.000,Hospital
23456,02JAN2014:00:00:00.000,06JAN2014:00:00:00.000,Nursing Home
23456,02JAN2014:00:00:00.000,06JAN2014:00:00:00.000,,Nursing Home
Desitred output :
i need to print below data set in a HTML page , mismatched records for ex : Patient_ID=12345 have different records in two the columns, I need to high light the column which is having mismatch , either bold or colored.
12345,02JAN2014:00:00:00.000,05JAN2014:00:00:00.000,Nursing Home
12345,02JAN2014:00:00:00.000,07JAN2014:00:00:00.000,Hospital
23456,02JAN2014:00:00:00.000,06JAN2014:00:00:00.000,Nursing Home
23456,02JAN2014:00:00:00.000,06JAN2014:00:00:00.000,,Nursing Home
Can i achieve this through sas
data have;
infile cards dlm=",";
input
Patient_ID : 8.
Admit_Date : anydtdtm.
Disch_Date : anydtdtm.
Facility_Type : $32.
;
format admit_date disch_date datetime19.;
cards;
12345,02JAN2014:00:00:00.000,05JAN2014:00:00:00.000,Nursing Home
12345,02JAN2014:00:00:00.000,07JAN2014:00:00:00.000,Hospital
23456,02JAN2014:00:00:00.000,06JAN2014:00:00:00.000,Nursing Home
23456,02JAN2014:00:00:00.000,06JAN2014:00:00:00.000,Nursing Home
;
run;
data flagged (keep=Patient_ID Admit_Date);
set have;
by Patient_ID Admit_Date;
dis_date_old = lag(Disch_Date);
fac_old = lag(Facility_Type);
if
not first.Admit_Date and (
Disch_Date ne dis_date_old or Facility_Type ne fac_old
)
then output;
run;
data want;
merge
have (in=a)
flagged (in=b)
;
if a;
flag = b;
run;
You can now use flag in a proc report compute block to change the format(s) of a displayed line.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.