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 (May 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 14 May 2007 21:52:22 +0000
Reply-To:   toby dunn <tobydunn@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   toby dunn <tobydunn@HOTMAIL.COM>
Subject:   Re: create count variable
Comments:   To: michael.ross@ASTRAZENECA.COM
In-Reply-To:   <5CA9E4A75962F64CA658FD81C05D6A010148A042@usuwamembx05.americas.astrazeneca.net>
Content-Type:   text/plain; format=flowed

Data Need ; Set Test ; By Person ;

If First.Person Then Cnt = 0 ;

If Mark = 'X' Then Cnt + 1 ;

Run ;

Toby Dunn

On the other hand, you have different fingers. ~ LCG

The early bird may get the worm, but the second mouse gets the cheese in the trap. ~ LCG

What happens if you get scared half to death, twice? ~ LCG

From: "Ross, Michael D" <michael.ross@ASTRAZENECA.COM> Reply-To: "Ross, Michael D" <michael.ross@ASTRAZENECA.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: create count variable Date: Mon, 14 May 2007 17:45:10 -0400

I'm looking to create a count variable that increments by 1 for each "Person", only when "Mark" variable is equal to an "x".

data test; length person $1. visit $1. date $8. mark $1.; input person visit date mark; datalines; 1 1 20070101 x 1 1 20070101 a 1 1 20070101 x 1 1 20070202 x 1 1 20070202 a 1 1 20070202 x 2 1 20070303 a 2 1 20070303 a 2 1 20070303 x 2 1 20070404 a 2 1 20070404 x 2 1 20070404 x ; run;

Tx Much.

_________________________________________________________________ Make every IM count. Download Messenger and join the iím Initiative now. Itís free. http://im.live.com/messenger/im/home/?source=TAGHM_MAY07


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