LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (November 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 8 Nov 2004 21:38:27 -0500
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: Defining first occurrence ..
Comments: To: Bernie Zimmerman <bernie.zimmerman@PRUDENTIAL.COM>

Bernie,

While I'll definitely be chastised for suggesting using a "goto" statement, the following should at least give you an idea of how to solve your problem:

data jan; input clientid day1-day31; year='2004'; month='jan'; cards; 0001 1 . . 1 . 1 . 1 . . . . . . . . . . . . . . . . . . . . . . 1 0002 . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0003 . . . . . . . . . 1 . . . . . . . 1 . . . . . . 1 . . . . . . ; run; data feb; input clientid day1-day31; year='2004'; month='feb'; cards; 0001 . 1 . 1 . 1 . 1 . . . . . . . . 1 . 1 . . . . . . . . . . . . 0002 1 . 1 . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . 0003 . . . . . 1 . . . . . . . . . . . . . . 1 . . . 1 . . . . . . ; run; data mar; input clientid day1-day31; year='2004'; month='mar'; cards; 0001 . . . 1 . . . 1 1 . . . . . . . . . . . . . . . . . . . . . 1 0002 . . . . 1 . . . . . . 1 . . . . . . . . . . . . . . . . . . . 0003 . 1 . . . . . . . 1 . . . . . . . 1 . . . . . . 1 . . . . . . ; run; data all (keep=clientid firstdate); set jan feb mar; array days(31) day1-day31; do i=1 to 31; if days[i] eq 1 then do; firstday=i; goto first; end; end; first: if firstday ne . then do; firstdate=input(put(i,2.)||trim(month)||trim(year),date9.); output; end; run;

Art --------- On Mon, 8 Nov 2004 16:35:49 -0500, Bernie Zimmerman wrote:

>I have three comma delimited Excel files, containing public web site visits >by day. That means for first quarter 2004, there are files for January, >February and March with 31, 29 and 31 days respectively. For each date in >each file if a 'client' visits the web site a 1 is assigned to that day's >variable, if not the value is (numeric) missing. (Each record has a client >ID as well as 31[max.] potential 1's or missing's associated with it.) > >What I need to do is find out the earliest date visited for each of the 3 >months and the earliest "absolute" date for the quarter.


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