I have the following character date format:
"3/1990"
"4/1990"
"5/1990"
...
I tried the following code:
data work.temps;
set indata;
newdate = input(strip(Date), MMYYSw.);
rename newdate = date;
run;
I keep on getting the following error meassage: Informat MMYYSW was not found or could not be loaded.
You may have to use a different informat to read in the character dates so that SAS can interpret them as numeric (since dates in SAS are actually numeric values), and then format them as MMYYS..
This was tested and works for me:
DATA temps;
FORMAT newdate MMYYS.;
SET indata;
newdate = INPUT(COMPRESS('01/'||date),DDMMYY10.);
RUN;
Try this with anydtdte:
data have;
input date $10.;
_date=input(compress(date,'""'),anydtdte.);
format _date MMYYs7.;
cards;
"3/1990"
"4/1990"
"5/1990"
;
run;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With