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 18:35:41 -0400
Reply-To:     hermans1 <hermans1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         hermans1 <hermans1@WESTAT.COM>
Subject:      Re: create an indicator
Comments: To: xihu lu <xihulu@YAHOO.COM>
Content-Type: text/plain; charset=US-ASCII

Thanks to your lucid declaration of what you want and your program for creating a dataset, it took only a minute or two to translate your requirements into a program and test it:

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

If you had a unique ID for each row, the SQL solution would further translate cleanly into any number of set-logic languages. For each ID group the program selects the maximum value for the group. Sig ______________________________ Reply Separator _________________________________ Subject: create an indicator Author: xihu lu <xihulu@YAHOO.COM> at Internet-E-Mail Date: 6/25/00 2:26 PM

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/


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