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 (June 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sun, 25 Jun 2000 15:05:02 -0700
Reply-To:   Jay Zhou <zhou_jay@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jay Zhou <zhou_jay@YAHOO.COM>
Subject:   Re: create an indicator
Comments:   To: xihu lu <xihulu@yahoo.com>
Content-Type:   text/plain; charset=us-ascii

Xihu,

Try this:

proc sql; create table result as select *, max(v1) as group from test group by id; quit;

Hope this helps,

Jay

--- xihu lu <xihulu@YAHOO.COM> wrote: > Hello, > > I wonder if someone could help me out with my > problem. > > I have a dataset: > > DATA TEST; > INFILE CARDS; > INPUT ID V1 ; > CARDS; > 1 1 > 1 1 > 1 2 > 2 1 > 2 1 > 3 1 > 3 2 > 3 3 > 4 1 > 4 1 > 5 2 > 5 2 > 5 2 > ; > RUN; > > Now I want to create a V1 indicator. If V1 is all > '1's > for an id, V1 indicator would be '1'; if V1 has > several > values for an id, and the max value would be the V1 > indicator. So Id 3's V1 indicator is 3. So the > result > would > look like: > > id V1 group > > 1 1 2 > 1 1 2 > 1 2 2 > 2 1 1 > 2 1 1 > 3 1 3 > 3 2 3 > 3 3 3 > 4 1 1 > 4 1 1 > 5 2 2 > 5 2 2 > 5 2 2 > > > I wonder how can I achieve this. Many thanks in > advance! > > Please reply to my address as I am not on the > mailing > list. > > > Xihu > > > __________________________________________________ > Do You Yahoo!? > Get Yahoo! Mail - Free email you can access from > anywhere! > http://mail.yahoo.com/

__________________________________________________ Do You Yahoo!? Get Yahoo! Mail - Free email you can access from anywhere! http://mail.yahoo.com/


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