Help using Base SAS procedures

intck assistance

Reply
N/A
Posts: 1

intck assistance

Current code is:
if date ge 20081228 and date le 20090103 then Week= 20081228 ;
else if date ge 20090104 and date le 20090110 then Week= 20090104 ;
else if date ge 20090111 and date le 20090117 then Week= 20090111 ;
else if date ge 20090118 and date le 20090124 then Week= 20090118 ;
else if date ge 20090125 and date le 20090131 then Week= 20090125 ;
else if date ge 20090201 and date le 20090207 then Week= 20090201 ;

This continues until the end of 2010. I'd like to condense this code using the intck function but can't seem to figure out how.

Any assistance would be greatly appreciated.
Occasional Contributor
Posts: 11

Re: intck assistance

try this

week = intnx('week',date,0,'b');

GL.
Super Contributor
Posts: 291

Re: intck assistance

here's one possibility ...

data test (drop=_Smiley Happy;
do _date='28dec08'd to '01jan2011'd by 7;
week='20'||put(intnx('week',_date,0,'b'),yymmdd6.);
output;
end;
run;
Ask a Question
Discussion stats
  • 2 replies
  • 259 views
  • 0 likes
  • 3 in conversation