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).
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.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more