0
votes

Hello I am trying to put an specific date from a dataset into a macro so i can use it in a DATA step , but i always get 01-JAN-1960 insteed of the date that i want my code is the next one:

      proc sql noprint ;
      select WEEK_START
      into :WEEK_START
      from date_table
      WHERE FW= 5;
      quit;

      %let start=&WEEK_START;
      %LET TODAY= TODAY();

I made this so i can see the date that i want:

      DATA TEMP;    
      DATE =&TODAY;    
      DATE1= &start;
      FORMAT DATE  DATE1 datE11.;
      RUN;

And the result is:

DATE : 06-OCT-2014 DATE1 : 01-JAN-1960

1
Your week start date is actually a datetime variable. Try using the dtdate11. Format instead. - Reeza

1 Answers

0
votes
  proc sql noprint ;
  select today()-1 as WEEK_START
  into :WEEK_START
    from maps.africa;
  quit;

  %let start=&WEEK_START;
  %LET TODAY= TODAY();


  DATA TEMP;    
  DATE =&TODAY;    
  DATE1= &start;
  FORMAT DATE  DATE1 datE11.;
  RUN;

When I run this, both populate correctly.

Additionally, the value of Date1 in your example is the date value for the numeric value of 0. It looks like your original data is being populated incorrectly.