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 (September 2011, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 9 Sep 2011 10:21:23 -0500
Reply-To:     Ryan Boyle <ryanjames@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ryan Boyle <ryanjames@GMAIL.COM>
Subject:      Re: A Data Manupulation _need help quick thanks
In-Reply-To:  <000301cc6f01$952f3090$bf8d91b0$@com>
Content-Type: text/plain; charset=ISO-8859-1

Nice work with the proc sql, Max. I did it with a transpose:

Data Tom; input subject set; cards; 1001 1 1001 2 1007 1 1009 1 1009 2 1010 1 ;

proc transpose data=tom out=tom2 (drop=_NAME_); by subject; var set; run;

data TomWants; set tom2; if col1 eq 1 and col2 eq .; drop col2; rename col1 = set; run;

On Fri, Sep 9, 2011 at 10:03 AM, bbser 2009 <bbser2009@gmail.com> wrote:

> Alternatively, we may use proc sql like below. > > Regards, Max > (Maaxx) > > Data Tom; > input subject set; > cards; > 1001 1 > 1001 2 > 1007 1 > 1009 1 > 1009 2 > 1010 1 > ; > > proc sql; > select * > from tom > group by subject > having sum(set=2)=0; > quit; > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Nat > Wooding > Sent: September-09-11 10:44 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: [SAS-L] A Data Manupulation _need help quick thanks > > Data Tom; > input subject set; > cards; > 1001 1 > 1001 2 > 1007 1 > 1009 1 > 1009 2 > 1010 1 > ; > * this assumes that the set is sorted by subject and set; > Data TomWants; > Set Tom; > by subject ; > if last.subject and set = 1; > run; > * this will select only one value for each subject; > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Tom > Smith > Sent: Friday, September 09, 2011 10:36 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: A Data Manupulation _need help quick thanks > > I have a following dataset > > > subject set > ------- --- > 1001 1 > 1001 2 > 1007 1 > 1009 1 > 1009 2 > 1010 1 > > > I neet only those subject who has value 1 for the set varialbes. > and the output dataset ( need a dataset not report) should be as below: > > subject set > ------- --- > 1007 1 > 1010 1 > > I know this might be simple, but for some reason my head is not working and > I need yoru help badly. >


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