does any one know how to get weeknumber within sas proc sql ?
Asked
Active
Viewed 5,428 times
2 Answers
5
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.

sasfrog
- 2,410
- 1
- 17
- 28
-
2More on the week function can be found in the online docs: http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003154994.htm – Laurent de Walick Mar 24 '11 at 13:48
1
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;

eupton
- 221
- 2
- 10