I used a date value in SAS and changed the format to mm/dd, but this doesn't help because the regression lines are just on either end of the graph rather than overlapping (picture attached) (I realize this is because SAS dates correspond to numbers from 1/1/1960). What I want is the mm/dd to correspond to numbers 1-365 so I get two overlapping regression lines to show how the trends changed from one year to the next. Anyone know how I can do this?
Thank you so much!
I have had several similar projects. The approach as @WarrenKuhfeld has done is to standardize all the dates to a common year and then on the X axis use a format that does not display year.
Another method to standardize would be
date = mdy(month(date),day(date),<year>);
where Year would be the year picked as a standard date. Suggest a leap year so you don't get odd artifacts when one of your data years is leap year.
With a known standard year you could still use Xaxis values such as Values=('01MAYYYYY'd to '01JAN<year+1'd by month).
Date5. format will display ddMON, no year.
data new;
set old;
days1 = date1 + 1 - '01May2019'd;
days2 = date2 + 1 - '01May2021'd;
run;
Then plot days1 and days2. Adjust the variables and dates as necessary.
I have had several similar projects. The approach as @WarrenKuhfeld has done is to standardize all the dates to a common year and then on the X axis use a format that does not display year.
Another method to standardize would be
date = mdy(month(date),day(date),<year>);
where Year would be the year picked as a standard date. Suggest a leap year so you don't get odd artifacts when one of your data years is leap year.
With a known standard year you could still use Xaxis values such as Values=('01MAYYYYY'd to '01JAN<year+1'd by month).
Date5. format will display ddMON, no year.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.