BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KALLEN
Obsidian | Level 7

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:

 

 

Obs Date Max_Temp Max_Temp_90 Max_Temp_100
101JAN199931250
201JAN200031270
301JAN200131251
401JAN200231299
501JAN200331275
601JAN200431220
701JAN200531190
801JAN200631110
901JAN200731273
1001JAN200831170
1101JAN200931293
1201JAN2010312710
1301JAN2011313015
1401JAN201231308
1501JAN201331262
1601JAN201431171
1701JAN2015313110
1801JAN201631202
1901JAN201731250
2001JAN201831288

 

Desired output:

Obs Date Max_Temp Max_Temp_90 Max_Temp_100
101AUG199931250
201AUG200031270
301AUG200131251
401AUG200231299
501AUG200331275
601AUG200431220
701AUG200531190
801AUG200631110
901AUG200731273
1001AUG200831170
1101AUG200931293
1201AUG2010312710
1301AUG2011313015
1401AUG201231308
1501AUG201331262
1601AUG201431171
1701AUG2015313110
1801AUG201631202
1901AUG201731250
2001AUG201831288

 

I have attached my dataset.

1 ACCEPTED SOLUTION

Accepted Solutions
mkeintz
PROC Star

Does proc timeseries accept "interval=year.8"?   (meaning years that begin on the 8'th month).

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

View solution in original post

2 REPLIES 2
mkeintz
PROC Star

Does proc timeseries accept "interval=year.8"?   (meaning years that begin on the 8'th month).

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
KALLEN
Obsidian | Level 7

Yes, a very quick and elegant solution. Thanks!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1139 views
  • 1 like
  • 2 in conversation