LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 12 Sep 2009 12:51:37 -0700
Reply-To:     ash <patelashr@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         ash <patelashr@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Counter/Loop
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

Hello there,

I hope someone can help me. From the sample data below, I would like to calculate number of trips at an AcctNo and FundNo level. One (1) trip is Purchase, then, Redem and Purchase again. Or, Redem, Purchase and Redem again of the same fundNo within the same account.

For example, AcctNo A1 Redem fundno 322 and there is no further activity under this account for the same fund, therefore, the trip is zero.

The same customer Redem fundno 432 on April 23 and Redem again on April 24, up to now there is no half or full trip yet. Let's continue... on May 2nd, this customer Purchase the same fund, therefore now there is a half trip (Redem and Purchase).... on June 3rd this customer Redem the same fund, now 1 full trip and so on.... I have calculate the trip (see last column) manually but I am sure there is a way to do this using SAS.

The data would be sorted in AcctNo, FundNo, Date order. I may have 60,000+ records.

Thanking you in advance. Ash

AcctNo FundNo Date Amount Trans Trip A1 322 20080415 -2000 Redemption 0 A1 432 20080423 -4000 Redemption 0 A1 432 20080424 -4767 Redemption 0 A1 432 20080502 5000 Purchase 0.5 A1 432 20080603 -5166 Redemption 1 A1 432 20080715 5000 Purchase 1.5 A1 432 20080716 2500 Purchase 1.5 A1 432 20080718 2500 Purchase 1.5 A1 432 20080724 2000 Purchase 1.5 A1 1944 20080715 1000 Purchase 0 A1 1944 20080814 -1000 Redemption 0.5 A1 1944 20080819 -2933 Redemption 0.5 A2 322 20080404 -6350 Redemption 0 A2 322 20080404 -15482 Redemption 0 A2 322 20080509 5000 Purchase 0.5 A2 322 20080523 5000 Purchase 0.5 A2 322 20080606 -10000 Redemption 1 A2 322 20080609 -5731 Redemption 1 A2 322 20080620 5000 Purchase 1.5 A2 322 20080623 -5127 Redemption 2 A2 322 20080703 5000 Purchase 2.5 A2 444 20080513 3009 Purchase 0 A2 444 20080725 -2887 Redemption 0.5


Back to: Top of message | Previous page | Main SAS-L page