| Date: | Tue, 12 Oct 2004 12:13:50 -0700 |
| Reply-To: | "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM> |
| Subject: | Re: data mining |
| Content-Type: | text/plain; charset="us-ascii" |
Try something like the following
DATA new (KEEP= location within incensus numfam);
/* read one location and determine if numfam is equal to count of
incensus families */
DO UNTIL(LAST.address);
SET old (RENAME location=address);
BY address;
IF FIRST.address THEN
count = numfam;
ELSE DO;
IF incensus = 'Y' THEN
count + -1;
END;
END;
/* re-read that location and generate output if not equal */
DO UNTIL(LAST.location);
SET old;
BY location;
IF count ^= 0 THEN
OUTPUT;
END;
RUN;
-----Original Message-----
From: Daniel Reyes [mailto:junkdalejreyes@yahoo.com]
Sent: Tuesday, October 12, 2004 5:14 AM
To: Schwarz, Barry A
Subject: RE: data mining
Oop!...darn....101 should have had a 3 NUMFAM value to highlight an
example of what I don't want. Since
NUMFAM is three and there are only two records with
"Y" flags, then this would not be included in the
output.
And yes the files are SAS datasets.
dan
--- "Schwarz, Barry A" <barry.a.schwarz@boeing.com>
wrote:
> Is your data in a SAS data set or in a sequential
> file. If the latter,
> is it sorted as implied by your sample?
>
> Should not 101 Main St be included in your sample
> output since NUMFAM is
> 2 but only 1 has Y?
>
> Barry Schwarz
> OS/390 System Programmer
> M/S 80-JE
> Phone: 253-773-4221
> Fax: 253-773-1257
>
>
> -----Original Message-----
> From: Daniel Reyes [mailto:junkdalejreyes@YAHOO.COM]
>
> Sent: Thursday, October 07, 2004 10:40 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: data mining
>
>
> I have a dataset of what we call basic street addresses--locations in
> which more than one address may be found, like
> apartment buildings.
> Examples
> include:
>
> 101 Main St Y 2
> 101 Main St Apt1 Y 0
> 101 Main St 2FL N 0
>
> 102 Main St Y 3
> 102 Main St 2 N 0
> 102 Main St 3rd FL N 0
> 102 Main St BSMT N 0
>
> 103 Main St Y 4
> 103 Main St #4 N 0
> 103 Main St STE6 Y 0
> 103 Main St ATTC Y 0
>
> Each record of the BSA will have a
> "within-structure" identifier (eg, 1
> or BSMT, etc), EXCEPT for the first instance when
> sorted by the address.
>
> Each record has a flag set called INCENSUS (Y or N).
>
> Each record has a flag set called NUMFAM (numeric,
> 0-999).
>
> I want to extract all BSAs (and their corresponding
> records) in which the number of the NUMFAM flag DOES
> NOT equal the total of good census records for the
> BSA
> (Ys).
>
> Therefore, for the example above, I ideally would
> like
> to see this in the output:
>
> 102 Main St Y 3
> 102 Main St 2 N 0
> 102 Main St 3rd FL N 0
> 102 Main St BSMT N 0
>
> 103 Main St Y 4
> 103 Main St #4 N 0
> 103 Main St STE6 Y 0
> 103 Main St ATTC Y 0
>
> Hope someone can help...please email me directly
>
> Thanks.
> Dan
>
>
>
> __________________________________
> Do you Yahoo!?
> Y! Messenger - Communicate in real time. Download
> now.
> http://messenger.yahoo.com
>
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
|