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 (January 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 9 Jan 2008 16:40:31 -0800
Reply-To:     sylia <sylia.chen@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         sylia <sylia.chen@GMAIL.COM>
Organization: http://groups.google.com
Subject:      how to count the unique frequency?
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

The sample dataset is below:

ID year quarter month buy channel multichannel 1 1998 1 2 1 N 0 1 1998 2 5 1 S 1 1 1998 3 2 1 1998 4 12 1 N 2 1 1999 1 1 1 M 2 1 1999 2 3 1 1999 3 7 1 R 3 1 1999 3 9 1 R 4 1 1999 4 11 1 W 4

================================= I need to count the multichannel. The multichannel is defined as the number of unique multichannel until the current quarter. For 1998, quarter 1, the multichannel is 0 since it's the first quarter and has no previous record. 1998, quarter 2, the multichannel is 1. And 1998, quarter 3 is 2. 1998, quarter 4, the multichannel is also 2 since N has appeared before and should not be counted again. Follow this role, 1999, quarter 4, multichannel is 4 instead of 5 because the current quarter purchase is not included.

Please tell me how to write the sas proc code. I thought about it all day and couldn't figure an way out.

Thank you very much!


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