week function in proc sql
does any one know how to get weeknumber within sas proc 开发者_如何学Gosql ?
Personally, I find it very hard to go past SAS's own, native WEEK
function. It can be called from inside proc sql
. Pass it a date value and it will give you the week number.
Found this at the following link: http://www.hollandnumerics.co.uk/sasfaq/SASFAQ1.HTM
You can simulate a WEEK function by using the SAS functions INTCK and INTNX, e.g.:
DATA getweek;
datevar=TODAY();
week=INTCK('WEEK',
INTNX('YEAR',datevar,0),
datevar)+1;
RUN;
精彩评论