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 (November 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 23 Nov 2008 22:42:32 -0800
Reply-To:     Van Nguyen <nana.nguyen@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Van Nguyen <nana.nguyen@GMAIL.COM>
Subject:      Problem with counter in data step
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I have the following dataset

ID Visit visitnum VisitDate 01 visit1 1 08Jul2008 01 visit1 1 08Jul2008 01 Temp visit . 09Jul2008 01 Temp visit . 09Jul2008 02 visit2 2 08Jul2008 02 visit2 2 09Jul2008 02 Temp visit . 12Aug2008 02 Temp visit . 12Aug2008 02 Temp visit . 15Aug2008 02 Temp visit . 15Aug2008 03 Visit1 1 .........

I would like to fill in visitnum as the below

ID Visit visitnum VisitDate 01 visit1 1 08Jul2008 01 visit1 1 08Jul2008 01 Temp visit 1.1 09Jul2008 01 Temp visit 1.1 09Jul2008 02 visit2 2 10Jul2008 02 visit2 2 10Jul2008 02 Temp visit 2.1 12Aug2008 02 Temp visit 2.1 12Aug2008 02 Temp visit 2.2 15Aug2008 02 Temp visit 2.2 15Aug2008 03 Visit1 1 .........

In summary, if I sort the dataset by id and visitdate and use the previous visit num and increment by .1 for the Temp Visit. I have problem with the ID 02 since it has 2 dates for Temp Visit.

Thanks for your help in advance.


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