BookmarkSubscribeRSS Feed
mastereh
Calcite | Level 5
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.
2 REPLIES 2
sfsdtegsdsdgdffhgfh
Fluorite | Level 6
try this

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

GL.
Bill
Quartz | Level 8
here's one possibility ...

data test (drop=_:);
do _date='28dec08'd to '01jan2011'd by 7;
week='20'||put(intnx('week',_date,0,'b'),yymmdd6.);
output;
end;
run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1307 views
  • 0 likes
  • 3 in conversation