0
votes

I have many dta observations in format ddmmmyyyy. The first date is 18AUG1894. How to change all the data obs into days when 18AUG1894 will be day 1? Next obs is 10SEP1984 so I want to have a day number that passes from my first date (eg day 84).

1
What did you try? What was the result? - Tom

1 Answers

0
votes

SAS date format is stored as an integer number of days. So, assuming your data are stored as numeric dates (not character), you simply subtract.

data want;
  set have;
  days_since_date = datevar - '10AUG1894'd;
run;

Or whatever your target date is.