DATA Step, Macro, Functions and more

PROC TIMESERIES unable to display selected number of days over a 15 years interval

Reply
Contributor
Posts: 24

PROC TIMESERIES unable to display selected number of days over a 15 years interval

Hi there,

 

I'm trying to prepare my Time Series data using PROC TIMEDATA. My data ranges from 1996 to 2015, but more specifically, it contains only the period from JULY 1st to OCTOBER 31st of each year, i.e., 123 days.

 

I've tried multiple strategies (specially trying to change the ID properties of interval/multiplier/shift/season length). Nothing seems to work. If I select "Group Analysis by":  Year, the output looks what I want, but the following analysis with proc esm does not represent the results that I want.

What I want is to apply Additive Seasonality Holt Winters and display all the seasonality coefficients for each of the 123 days for each year (given the first year -1996 -  was taken as a basis).

 

Can anyone give me some help?

 

The code that I have so far is below and I've attached the dataset too.

 

%let path=/folders/myfolders/hmw;  *defining work directory;
libname hmw "&path"; *assigning a library to store files;


FILENAME REFFILE '/folders/myfolders/hmw/temps.txt';

PROC IMPORT DATAFILE=REFFILE
	DBMS=DLM
	OUT=HMW.temps;
	DELIMITER='09'x; *the hexadecimal representation of Tab in ASCII;
	GETNAMES=YES;
	GUESSINGROWS=100;
RUN;


*PROC CONTENTS DATA=HMW.temps; *RUN; * see some useful info about data;
*title 'The Dataset temps.txt';
*PROC PRINT DATA=HMW.temps;* RUN; *print the data set;
*title;

/* stacking the year columns to make one response column */
data work.__tmp__;
	set HMW.TEMPS;
	_Case_=_n_;
run;
proc transpose data=work.__tmp__ out=WORK.temps_stacked(rename=(col1=Temp)) name=Year;
	var _1996 _1997 _1998 _1999 _2000 _2001 _2002 _2003 _2004 _2005 _2006 _2007 
		_2008 _2009 _2010 _2011 _2012 _2013 _2014 _2015;
	by _Case_;
run;
data WORK.temps_stacked;
	merge work.__tmp__(keep=_Case_ DAY) WORK.temps_stacked;
	drop _Case_;
	by _Case_;
run;
proc delete data=WORK.__tmp__;
run;

/* creating new variable date with format MMDDYY10. */
data WORK.TEMPS_STACKED;
	length Year $ 8;
	set WORK.TEMPS_STACKED;
	select (Year);
		when ('_1996') Year='1996';
		when ('_1997') Year='1997';
		when ('_1998') Year='1998';
		when ('_1999') Year='1999';
		when ('_2000') Year='2000';
		when ('_2001') Year='2001';
		when ('_2002') Year='2002';
		when ('_2003') Year='2003';
		when ('_2004') Year='2004';
		when ('_2005') Year='2005';
		when ('_2006') Year='2006';
		when ('_2007') Year='2007';
		when ('_2008') Year='2008';
		when ('_2009') Year='2009';
		when ('_2010') Year='2010';
		when ('_2011') Year='2011';
		when ('_2012') Year='2012';
		when ('_2013') Year='2013';
		when ('_2014') Year='2014';
		when ('_2015') Year='2015';
		otherwise Year=Year;
	end;
	date_concat =cats(DAY,'-', Year);
    date = input(date_concat,DATE11.);
    format date MMDDYY10.;
RUN;
Ask a Question
Discussion stats
  • 0 replies
  • 139 views
  • 0 likes
  • 1 in conversation