BookmarkSubscribeRSS Feed
Pooja98
Fluorite | Level 6

Hi,

 

i have the column name as week1 week2, week3 and so on upto week100.

i need week1 as 29-Oct and week2 as 22-Oct and week3 as 15-Oct and so on.

Like, week 1 is current week, week2 is -7 of current week.

 

For example,

week1     week2      week3 

29-Oct      22-Oct      15-Oct

 

thanks

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

Should it always be the friday of the week?

Pooja98
Fluorite | Level 6

Yes

PeterClemmensen
Tourmaline | Level 20

Try this

 

data want;
   array w {*} week1 - week100;
   
   w[1] = intnx("week.6", date(), 1);
   
   do i = 2 to dim(w);
      w[i] = w[i - 1] - 7;
   end;
   
   format week: date9.;
run;
Pooja98
Fluorite | Level 6

Not working

the values below the week column got changed

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1154 views
  • 0 likes
  • 2 in conversation