views:

48

answers:

1

Hye Guys,

I'm busy working on a time series and am trying to find the commands that allow me to insert a quarter count variable. To keep things simple, the third quarter of 1995 (date my observations start) should be quarter -2, the fourth quarter of 1995 should be -1 etc etc uptill 2006 (should be somewhere around 45 by then). My dates are in date9 format, such as 20JUN04 etc..

Anyone who can help me with the commands I need t o let this work in SAS?

Thanks

+1  A: 

SAS has pretty good built in date and datetime functions. Try this:

/* Some sample data */
data dates;
    format dateval date9.;
    informat dateval date9.;
    input dateval;
    datalines;
'01JUL95'
'01OCT95'
'01JAN96'
'20JUN04'
; 
run;

/* Sample of the intck function */
data _null_;
    set dates;
    quarter=intck('qtr','01JAN96'd,dateval);
    put _all_;
run;
Ville Koskinen