Date: Thu, 27 Nov 2008 21:45:30 -0800
Reply-To: Alejandro <acajigal@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Alejandro <acajigal@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: delete multiple instances of same value in different fields?
Content-Type: text/plain; charset=ISO-8859-1
On Nov 26, 7:05 pm, art...@NETSCAPE.NET (Arthur Tabachneck) wrote:
> Alejandro,
>
> I'm not sure if I correctly understand what you want to do. Does the
> following come close?
>
> data have;
> infile cards missover;
> input
> zip1 observed expected zip3
> area1 area2 area3 area4 area5;
> cards;
> 10001 10 12 10001 10002 10014 10023 10024
> 10002 0 0 10002 10001 10004 10029 10031 10055
> 10003 5 9 10003 10004 10005 10006 10012 10018
> 10001 0 0 10004 10003 10005 10007 10023
> ;
>
> proc sql noprint;
> select distinct zip3 into :misses
> separated by ' '
> from have
> where expected eq 0;
> quit;
>
> data want;
> set have;
> array area(5) area1-area5;
> do i=1 to 5;
> if area(i) in (&misses.) or
> missing(area(i)) then
> area(i)=99999;
> end;
> call sortn(of area[*]);
> do i=1 to 5;
> if area(i) eq 99999 then
> call missing(area(i));
> end;
> run;
>
> Art
> -------
>
> On Wed, 26 Nov 2008 15:05:49 -0800, Alejandro <acaji...@GMAIL.COM> wrote:
> >if I have a dataset where my expected = 0 , then I cannot use that zip
> >code.
> >i then need to remove that zipcode from every instance in my table and
> >replace it with a blank.
> >how do i do this?
>
> >this is for an analysis using a cluster detection scan statistic
> >called FlexScan. FlexScan does not like missing expected values (no,
> >I can't just use 0.00001) and I need to delete every zip code in the
> >matrix file that it uses. The matrix file is the list of connected
> >zipcodes in the zip3, area1, area2, ..., area18 columns.
>
> >Here's an example (this is a made-up dataset for simplicity...these
> >zips aren't all connected in reality):
> >zip1 observed expected zip3 area1 area2
> >area3 area4 area5
> >10001 10 12 10001 10002 10014
> >10023 10024
> >10002 0 0 10002 10001 10004
> >10029 10031 10055
> >10003 5 9 10003 10004 10005 10006
> >10012 10018
> >10001 0 0 10004 10003 10005
> >10007 10023
>
> >In these 4 records, zips 10002 and 10004 both having missing
> >expecteds, so I need to delete zips 10002 and 10004 from every column.
wow, thanks Art. that looks right. i'll give it a try tomorrow and
let you know.
|