Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAS not recognizing date format

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.

like image 883
Josh Avatar asked Dec 09 '25 18:12

Josh


2 Answers

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;
like image 133
ander2ed Avatar answered Dec 11 '25 07:12

ander2ed


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;
like image 30
Shenglin Chen Avatar answered Dec 11 '25 07:12

Shenglin Chen