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;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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