Date: Tue, 29 Mar 2005 13:01:44 -0700
Reply-To: Michael Murff <mjm33@MSM1.BYU.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Michael Murff <mjm33@MSM1.BYU.EDU>
Subject: IsNumeric Application (Parsing Addresses)
Content-Type: text/plain; charset="us-ascii"
Given the recent discussion topic "IsNumeric", I got up the gumption to try
to parse foot measurements from an address string (real project). I am
trying to parse out each measurement after Front: and Side: and sum them
into a new var called sumFS. This is probably easy, but my efforts to scan
out all the relevant numeric characters are confounded by the numeric street
addresses such as (Front:136' Glendale Side:95' 23rd Ln.) Note that
measurements may be 2-4 digits in length. My sample code below seems to work
for all but the numeric street addresses noted above. Can someone advise me
on this issue?
input measure $50.;
Front:100' College Av Side:N/Av
Front:310' Tatum Side:N/Av
Front:160' Thomas Rd Side:N/Av
Front:80' Apache Tr. Side:N/Av
Front:165' 33rd St Side:201' Atlanta
Front:229' Thomas Rd.
Front:90' Indian Schl Side:N/Av Front:1000 '
Front:545' S. 7th
Front:173' Hardy Dr.
Front:136' Glendale Side:95' 23rd Ln.
Front:104' McDowell Side:N/Av
Front:73' Camelback Side:N/Av
Front:147' Country Side:200'
Front:81' Cave Side:N/Av
Front:1160' 11th Ave.
Front:300' 54th Ave.
Front:100' 29th Ave.
length front side $10.;
if index(measure,"Side:") then do;
if not missing( input (front, ?? best32. ) ) and not missing( input
(side, ?? best32. ) ) then do;
sumFS = input(front,best12.) + input(side,best12.);
else if not missing( input (front, ?? best32. ) ) then sumFS = front;
/* Why does obs 12 fail ??? */