I am converting daily data into yearly data for August 1999 - 2018. However, when I use proc timeseries, it starts the series at January 1, 1999 instead of at August 1, 1999. How do I keep August and prevent proc timeseries from labeling the date as January?
Below is my code:
/* convert monthly data to yearly data */
proc timeseries data=aug_monthly_weather_90_100 out=aug_yearly_weather_90_100;
id date interval=year accumulate=n;
var Max_Temp Max_Temp_90 Max_Temp_100;
format date date9.;
run;Current, incorrect output:
| 1 | 01JAN1999 | 31 | 25 | 0 |
| 2 | 01JAN2000 | 31 | 27 | 0 |
| 3 | 01JAN2001 | 31 | 25 | 1 |
| 4 | 01JAN2002 | 31 | 29 | 9 |
| 5 | 01JAN2003 | 31 | 27 | 5 |
| 6 | 01JAN2004 | 31 | 22 | 0 |
| 7 | 01JAN2005 | 31 | 19 | 0 |
| 8 | 01JAN2006 | 31 | 11 | 0 |
| 9 | 01JAN2007 | 31 | 27 | 3 |
| 10 | 01JAN2008 | 31 | 17 | 0 |
| 11 | 01JAN2009 | 31 | 29 | 3 |
| 12 | 01JAN2010 | 31 | 27 | 10 |
| 13 | 01JAN2011 | 31 | 30 | 15 |
| 14 | 01JAN2012 | 31 | 30 | 8 |
| 15 | 01JAN2013 | 31 | 26 | 2 |
| 16 | 01JAN2014 | 31 | 17 | 1 |
| 17 | 01JAN2015 | 31 | 31 | 10 |
| 18 | 01JAN2016 | 31 | 20 | 2 |
| 19 | 01JAN2017 | 31 | 25 | 0 |
| 20 | 01JAN2018 | 31 | 28 | 8 |
Desired output:
| 1 | 01AUG1999 | 31 | 25 | 0 |
| 2 | 01AUG2000 | 31 | 27 | 0 |
| 3 | 01AUG2001 | 31 | 25 | 1 |
| 4 | 01AUG2002 | 31 | 29 | 9 |
| 5 | 01AUG2003 | 31 | 27 | 5 |
| 6 | 01AUG2004 | 31 | 22 | 0 |
| 7 | 01AUG2005 | 31 | 19 | 0 |
| 8 | 01AUG2006 | 31 | 11 | 0 |
| 9 | 01AUG2007 | 31 | 27 | 3 |
| 10 | 01AUG2008 | 31 | 17 | 0 |
| 11 | 01AUG2009 | 31 | 29 | 3 |
| 12 | 01AUG2010 | 31 | 27 | 10 |
| 13 | 01AUG2011 | 31 | 30 | 15 |
| 14 | 01AUG2012 | 31 | 30 | 8 |
| 15 | 01AUG2013 | 31 | 26 | 2 |
| 16 | 01AUG2014 | 31 | 17 | 1 |
| 17 | 01AUG2015 | 31 | 31 | 10 |
| 18 | 01AUG2016 | 31 | 20 | 2 |
| 19 | 01AUG2017 | 31 | 25 | 0 |
| 20 | 01AUG2018 | 31 | 28 | 8 |
I have attached my dataset.
Does proc timeseries accept "interval=year.8"? (meaning years that begin on the 8'th month).
Does proc timeseries accept "interval=year.8"? (meaning years that begin on the 8'th month).
Yes, a very quick and elegant solution. Thanks!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.