stallingOne
stallingOne

Reputation: 4006

How to get a weekly interval starting on mondays in sas proc timeseries?

The sas proc timeseries is able to compute weekly totals like this:

proc timeseries
        data=work.sorttemptablesorted
        out=work.weeklyagregated
        ;
    id dateusedforstatistics interval=week zeromiss=none ;
    var cases / accumulate=total setmissing=0;
    by subject network;
run;quit;

It's almost perfect, but the only thing is that it agregates weeks starting on sundays

Sun, 25 Feb 2007    2
Sun, 4 Mar 2007 0
Sun, 11 Mar 2007    0
Sun, 18 Mar 2007    1
Sun, 25 Mar 2007    2
Sun, 1 Apr 2007 11

And I cannot find a solution to compute the same with weeks starting on mondays instead.

Is there a option for INTERVAL= that makes weeks start on mondays?

(using SAS9.3)

Upvotes: 1

Views: 938

Answers (1)

Quentin
Quentin

Reputation: 6378

I don't have ETS, so don't know PROC TIMESERIES. With the INTCK() function, when you specify an interval you can also specify a "shift index", so e.g. week.2 would be weeks starting on Monday rather than the default week.1 which is weeks starting on Sunday. You could try changing to interval=week.2, but I took a look at the docs and didn't look like it was documented.

Upvotes: 2

Related Questions