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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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