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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1598 views
  • 0 likes
  • 3 in conversation