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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 772 views
  • 1 like
  • 3 in conversation