Good Evening,
im reading in an input file that has dates in text format.
IDAT $ EDAT $ TRDAT $
Idat and TRDat
Both look similar to
Idate | trdate |
20170426 | 20170426 |
my goal is to compare if the date are identical or not.(1 or 0)
You don't have to convert the to dates to check if they're equal if they look the same. You can check directly.
I would suggest using an INFORMAT to specify the format type - yymmdd8 and then format the date with a date9 format.
Here's some skeleton code:
data have;
informat idat edat trtdat yymmdd8.;
format idat edat trtdat date9.;
input idat edit trtdat;
if idat = trtdat then do;
****whateever you want to do here*****;
end;
run;
You have two text strings therefore:
identical=ifc(strip(edat)=strip(trtdat),1,0);
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.