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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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