help with sas code data step

Accepted Solution Solved
Reply
Contributor
Posts: 42
Accepted Solution

help with sas code data step

Hello,

I have a data set that has each instances of payments made by account_id.

Here is the sample data.

data test;

infile datalines;

input id $ payment date yymmdd10.;

format date yymmdd10.;

datalines;

1 20 2010-01-31

1 20 2010-02-28

1 40 2010-04-28

1 50 2010-07-02

2 40 2012-01-31

2 50 2012-02-28

2 10 2012-03-28

3 100 2013-02-20

3 200 2014-02-01

4 400 2011-01-31

5 50 2000-01-31

5 30 2001-02-28

6 10 2001-02-02

6 10 2001-03-03

6 10 2001-04-02

6 10 2001-05-03

;

run;

Now I need to keep the rows for each id, until the payment(cumulative payment) is greater than 70. So the final output will look like as follows.

1 20 2010-01-31

1 20 2010-02-28

1 40 2010-04-28

2 40 2012-01-31

2 50 2012-02-28

3 100 2013-02-20

4 400 2011-01-31

5 50 2000-01-31

5 30 2001-02-28

6 10 2001-02-02

6 10 2001-03-03

6 10 2001-04-02

6 10 2001-05-03

Thank you for the help in advance.

PS


Accepted Solutions
Solution
‎02-23-2014 07:16 PM
PROC Star
Posts: 7,360

Re: help with sas code data step

Methinks this is the same question I just responded to.  No?

View solution in original post


All Replies
Solution
‎02-23-2014 07:16 PM
PROC Star
Posts: 7,360

Re: help with sas code data step

Methinks this is the same question I just responded to.  No?

Contributor
Posts: 42

Re: help with sas code data step

Yes you did Smiley Happy. Thank you.

Contributor
Posts: 33

Re: help with sas code data step

Hi,

Is the problem resolved? If yes can you share the solution?

Vishal

Contributor
Posts: 42

Re: help with sas code data step

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 313 views
  • 0 likes
  • 3 in conversation