Date: Fri, 22 May 2009 13:47:43 -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: Deleting rows in a data set...help required
In-Reply-To: <200905221743.n4MAnvlG002851@malibu.cc.uga.edu>
Content-Type: text/plain; charset="US-ASCII"
That may have been a Far Side Strip. I seem to recall having seen it in the
US.
Thanks to everyone for pitching in on the problem.
Nat
Nat Wooding
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
Gerhard
Hellriegel
<gerhard.hellrieg To
el@T-ONLINE.DE> SAS-L@LISTSERV.UGA.EDU
Sent by: "SAS(r) cc
Discussion"
<SAS-L@LISTSERV.U Subject
GA.EDU> Re: Deleting rows in a data
set...help required
05/22/2009 01:43
PM
Please respond to
Gerhard
Hellriegel
<gerhard.hellrieg
el@T-ONLINE.DE>
YES! That remebers me of a nice joke in "Spektrum der Wissenschaft" a
german science magazine for half-scientists like me.
There was a long mathematical formula on a board, in the middle a small
flash with the note "here a miracle occures". Some scientists are standing
in front of that and one says (in a bubble, like Donald Duck...): "here we
have to become a bit more exact..."
Have a nice weekend!
Gerhard
On Fri, 22 May 2009 10:37:16 -0700, Terjeson, Mark <Mterjeson@RUSSELL.COM>
wrote:
>:o) That got me laughing at myself.
>Yeah, the horizon I was envisioning
>was a bit more modest. har har
>
>For a small number its one of the cute
>approaches, but as you infer, Nat+Joe's
>approach is more robust.
>
>I didn't think the small set of matches
>would turn out to be the Friday Humor. har har
>
>Mark :o) <vbg>
>
>
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>Gerhard Hellriegel
>Sent: Friday, May 22, 2009 10:32 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: Deleting rows in a data set...help required
>
>hmm, also with 2000 variables?
>
>tmp = id1*1e3998+id2*1e3996+id3*1e3994+...+id2000;
> !
> here its necessary to get a bit exacter!
>at some other locations too, eg here:
>if tmp in(11111111...,22222222...) then delete;
>
>Gerhard
>
>
>
>
>On Fri, 22 May 2009 10:10:02 -0700, Terjeson, Mark
><Mterjeson@RUSSELL.COM>
>wrote:
>
>>Hi Dinesh,
>>
>>This can be handled many ways.
>>
>>Here is one fun way using pattern matching
>>to reduce the number of lines of code and
>>the number of pieces to process:
>>
>>
>>data sample;
>> 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;
>>
>> * a unique pattern handling approach ;
>>data result(drop=tmp stmp i);
>> set sample;
>> tmp = id1*1e6+id2*1e4+id3*1e2+id4;
>> if tmp in(11111111,22222222) then delete;
>> stmp = put(tmp,8.);
>> do i = 1 to 4;
>> substr(stmp,i*2-1,2) = tranwrd(substr(stmp,i*2-1,2),'21','12');
>> end;
>> if stmp eq '12121212' then delete;
>>run;
>>
>>
>>
>>
>>Of course, the number of variables can be
>>accommodated by increasing/decreasing the
>>tmp= formula and adjusting the do loop
>>end count.
>>
>>
>>
>>Hope this is helpful.
>>
>>
>>Mark Terjeson
>>Investment Business Intelligence
>>Investment Management & Research
>>Russell Investments
>>253-439-2367
>>
>>
>>Russell
>>Global Leaders in Multi-Manager Investing
>>
>>
>>
>>
>>
>>-----Original Message-----
>>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>>Dinesh
>>Sent: Friday, May 22, 2009 9:22 AM
>>To: SAS-L@LISTSERV.UGA.EDU
>>Subject: Deleting rows in a data set...help required
>>
>>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.
|