Search code examples
sasdate-conversion

SAS text to date format


I have a very basic question in SAS

I have the following macro variable which is in text format, I want to convert to a date format...not too sure how to do this:

%let mydt = 06/30/1999;

How do I convert this into a date format so that^

%let mydtnew = "06/30/1999"d;

Thanks for your help...


Solution

  • Try this - is that what you were after?

    %let mydt = 06/30/1999;
    
    %let mydt2  = %sysfunc(inputn(&mydt,mmddyy10.));
    
    %put &mydt2;