Date: Mon, 25 May 2009 09:10:06 -0400
Reply-To: Nathaniel.Wooding@DOM.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nat Wooding <Nathaniel.Wooding@DOM.COM>
Subject: Re: Fw: Re: Deleting rows in a data set...help required
In-Reply-To: <200905241615.n4OAs7pA028832@malibu.cc.uga.edu>
Content-Type: text/plain; charset="US-ASCII"
Art
I was sort of buried in the latter part of the text. I, too, missed it the
first time around.
Nat
Nat Wooding
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
Arthur Tabachneck
<art297@NETSCAPE.
NET> To
SAS-L@LISTSERV.UGA.EDU, Nat Wooding
05/24/2009 12:15 <Nathaniel.Wooding@DOM.COM>
PM cc
Subject
Re: Fw: Re: Deleting rows in a data
set...help required
Nat,
I must have missed something in this thread as I never saw anything in the
OP's request indicating that the values would be limited to only 11,12,21
and 22.
I would have created an informat to take care of the transposition problem
and then delete records that only had constant values of 11,12 or 22.
proc format;
invalue transpo
21=12
;
run;
data sample;
input (id1-id4) (transpo3.);
if min(of id1-id4) eq max(of id1-id4)
and min(of id1-id4) in (11,12,22)
then delete;
cards;
11 12 22 11
22 11 12 12
11 11 11 11
12 21 12 21
11 22 12 12
12 21 22 11
11 22 22 22
22 22 22 22
12 21 22 11
11 22 11 21
13 13 13 13
12 13 21 13
;
Art
-------
On Sun, 24 May 2009 10:42:03 -0400, Nat Wooding <Nathaniel.Wooding@DOM.COM>
wrote:
>Someone should have taken me to task for not simply deleting the record if
>a number was not in 11 and 21.
>
>
>I think that if you add
>
>Array able _numeric_;
>Do over able;
> if able not in( 11 , 21 ) then delete;
>
>** bad code if able not in( 11 , 21 ) then flag = 1;
>end;
>* not needed if flag;
>* not needed drop flag;
>
>to my code, you fix the second half of the problem;
>
>And for inquiring minds, the Do Over was an early SAS construct that was
>dropped from the documention around V5 but still works.
>
>Nat Wooding
>Environmental Specialist III
>Dominion, Environmental Biology
>4111 Castlewood Rd
>Richmond, VA 23234
>Phone:804-271-5313, Fax: 804-271-2977
>
>
>
> "Terjeson, Mark"
> <Mterjeson@russel
> l.com> To
> "Joe Matise" <snoopy369@GMAIL.COM>,
> 05/22/2009 01:33 <SAS-L@LISTSERV.UGA.EDU>,
> PM <Nathaniel.Wooding@DOM.COM>
> cc
>
> Subject
> RE: Re: Deleting rows in a
> data set...help required
>
>
>
>
>
>
>
>
>
>
>Nicely done by the [Nat+Joe] tag-team.
>Clever approach.
>Mark
>
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Joe
>Matise
>Sent: Friday, May 22, 2009 10:29 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: Deleting rows in a data set...help required
>
>You can accomodate that by adding:
>if max(of id:) = 21 and min(of id:) = 12 then delete;
>since 11 is smaller and 22 is higher than those.
>
>-Joe
>
>On Fri, May 22, 2009 at 12:20 PM, Gerhard Hellriegel <
>gerhard.hellriegel@t-online.de> wrote:
>
>> ...but you won't get out the 12 / 21 rows with that.
>> Gerhard
>>
>>
>> On Fri, 22 May 2009 13:10:04 -0400, Nat Wooding
>> <Nathaniel.Wooding@DOM.COM> wrote:
>>
>> >Dinesh
>> >
>> >Here, we can use the max and min functions and the SAS automatic
>variable
>> >_numeric_ which refers to all of the numeric variables in a data set.
>> >
>> >Data D;
>> >input id1 id2 id3 id4 ;
>> >cards;
>> > 11 12 22 11
>> > 22 11 12 12
>> > 11 11 11 11
>> > 12 21 12 21
>> > 11 22 12 12
>> > 12 21 22 11
>> > 11 22 22 22
>> > 22 22 22 22
>> > 12 21 22 11
>> > 11 22 11 21
>> > run;
>> > Data Wanted;
>> > set D;
>> > if max(of _numeric_) = min( of _numeric_) then delete;
>> >run;
>> >proc print;
>> >run;
>> >
>> >Nat Wooding
>> >Environmental Specialist III
>> >Dominion, Environmental Biology
>> >4111 Castlewood Rd
>> >Richmond, VA 23234
>> >Phone:804-271-5313, Fax: 804-271-2977
>> >
>> >
>> >
>> > Dinesh
>> > <mtdinesh@GMAIL.C
>> > OM>
>To
>> > Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU
>> > Discussion"
>cc
>> > <SAS-L@LISTSERV.U
>> > GA.EDU>
>> Subject
>> > Deleting rows in a data
>set...help
>> > required
>> > 05/22/2009 12:21
>> > PM
>> >
>> >
>> > Please respond to
>> > Dinesh
>> > <mtdinesh@GMAIL.C
>> > OM>
>> >
>> >
>> >
>> >
>> >
>> >
>> >Dear All,
>> >
>> >I have some problems with my analysis..
>> >
>> >I have a data set with around 2000 columns and 50000 rows....
>> >
>> >the dataset appears like this...
>> >
>> > id1 id2 id3 id4---------
>> >1 11 12 22 11
>> >2 22 11 12 12
>> >3 11 11 11 11
>> >4 12 21 12 21
>> >5 11 22 12 12
>> >6 12 21 22 11
>> >7 11 22 22 22
>> >8 22 22 22 22
>> >9 12 21 22 11
>> >10 11 22 11 21
>> >-
>> >-
>> >-
>> >-
>> >
>> >Now..what i need is that, if a particular row contain same values
>> >throughout the 2000 columns i want to delete it.
>> >So if a row contains all 11 or all 22 or all 12 or all 21 it should
>be
>> >deleted... also 12 and 21 are same and if a row contains only 12 and
>> >21 it can also be deleted...
>> >
>> >so the final output will appear like
>> >
>> > id1 id2 id3 id4------
>> >1 11 12 22 11
>> >2 22 11 12 12
>> >5 11 22 12 12
>> >6 12 21 22 11
>> >7 11 22 22 22
>> >9 12 21 22 11
>> >10 11 22 11 21
>> >-
>> >-
>> >-
>> >-
>> >
>> >rows 3 , 4 and 8 should be deleted...
>> >
>> >
>> >Please help me to solve this
>> >
>> >Thanks
>> >
>> >Dinu
>> >
>> >
>> >CONFIDENTIALITY NOTICE: This electronic message contains
>> >information which may be legally confidential and or privileged and
>> >does not in any case represent a firm ENERGY COMMODITY bid or offer
>> >relating thereto which binds the sender without an additional
>> >express written confirmation to that effect. The information is
>> >intended solely for the individual or entity named above and access
>> >by anyone else is unauthorized. If you are not the intended
>> >recipient, any disclosure, copying, distribution, or use of the
>> >contents of this information is prohibited and may be unlawful. If
>> >you have received this electronic transmission in error, please
>> >reply immediately to the sender that you have received the message
>> >in error, and delete it. Thank you.
>>
>
>
>CONFIDENTIALITY NOTICE: This electronic message contains
>information which may be legally confidential and or privileged and
>does not in any case represent a firm ENERGY COMMODITY bid or offer
>relating thereto which binds the sender without an additional
>express written confirmation to that effect. The information is
>intended solely for the individual or entity named above and access
>by anyone else is unauthorized. If you are not the intended
>recipient, any disclosure, copying, distribution, or use of the
>contents of this information is prohibited and may be unlawful. If
>you have received this electronic transmission in error, please
>reply immediately to the sender that you have received the message
>in error, and delete it. Thank you.
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.
|