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!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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