I'm a little bit stuck with a request from my boss who wants to know how long it takes a customer to spend 75% of a credit voucher. The customer can use the voucher many times for many variously priced goods but she wants the time period that it takes to meet or exceed 75% of the value. Vouchers can be for any amount but are normally in the non-rounded hundreds to a few thousands (i.e $543.00 may be a value). I was planning to firstly get the value of each voucher, then to begin adding up the purchases until the sum is equal to or exceeds 75% of the voucher value, then taking the date when that happens and subtracting the issue date of the voucher (or the date of the voucher's first use). Not sure how to go about the coding yet but conceptually I'm looking to try something like (plain text version as opposed to an attempt to code): eg, for a voucher that is $1000.00, array(date_of_purchase) _temp_; do I = 1 to (total number of purchases on a voucher); running_value=_value +purchase_value do until (running_value =1000 *0.75); Number_purchases=I; duration=date_of_purchase(I) - voucher_issue_date; end; end; The data are structured in SAS with each row having a customer id, date of purchase, value of purchase and an indicator if the purchase is from a voucher (as well as the goods, quantity etc.) Has anyone done anything similar that they could please share with me? My boss knows that this is likely on the verge of my skill set and that I'm seeking help to get this done ("it's a learning experience!"). I'm not sure if this is a simple process that I am over complicating. Thanks Gordon
... View more