BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hk2013
Fluorite | Level 6

i have 4 columns in my data set 1: todays date  2: ID 3: member_visit 4: target to hit every week

 

Date                   ID           Member_visit              target_to_hit_per_week

19jun2018         1                   230                                20

19jun2018         2                   357                                 10

19jun2018         3                  100                                  40

19jun2018         4                   444                                  5

19jun2018         5                    159                               30

19jun2018        6                     300                                11

 

what I want  add next 16 weekly dates and what the total be if the IDs hit their weekly total 

 

Example: 

 

ID              future_date                future_total

1                 25JUN2018               230+20 = 250

1                 02JUL2018               250+20 = 270

1                09JUL2018                 270+20 = 290

1                 16JUL2018                290+20=310

1                 23JUL2018               

1                         

1                       

1                             

 

1 ACCEPTED SOLUTION
4 REPLIES 4
hk2013
Fluorite | Level 6

I just realize that this is giving me every day of the week but i only want first day of the weeks so that target_to_hit_per_week is added ones a week not daily. or is there a way that it can give it daily but target_to_hit_per_week is only added once a week.

Kurt_Bremser
Super User

@hk2013 wrote:

I just realize that this is giving me every day of the week but i only want first day of the weeks so that target_to_hit_per_week is added ones a week not daily. or is there a way that it can give it daily but target_to_hit_per_week is only added once a week.


Your example contains only one date, and I assumed that is the state of your dataset. Please post a more realistic example.

novinosrin
Tourmaline | Level 20

intnx is an equivalent

 

future_total=Member_visit;
do futuredate =intnx('week',date,1)+1 to intnx('week',date,7)+1 by 7;
future_total+target_to_hit_per_week;
output;
end;

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 782 views
  • 1 like
  • 3 in conversation