LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2005, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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"

Hi SAS-L,

SAS-L,

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?

Many thanks,

Michael Murff

Provo, UT

data frontage;

input measure $50.;

obsno=_N_;

cards4;

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:128' Missouri

Front:90' Indian Schl Side:N/Av Front:1000 '

Front:N/Av

Front:545' S. 7th

Front:173' Hardy Dr.

Front:136' Glendale Side:95' 23rd Ln.

Front:63' Camelback

Front:104' McDowell Side:N/Av

Front:182' Riley

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.

;;;;

run;

data f2;

length front side $10.;

set frontage;

front=scan(scan(measure,1,"Front:"),1,"'");

if index(measure,"Side:") then do;

side=scan(scan(measure,-1,"Side:"),1,"'");

end;

if not missing( input (front, ?? best32. ) ) and not missing( input (side, ?? best32. ) ) then do;

sumFS = input(front,best12.) + input(side,best12.);

end;

else if not missing( input (front, ?? best32. ) ) then sumFS = front;

run;

/* Why does obs 12 fail ??? */

proc print;run;


Back to: Top of message | Previous page | Main SAS-L page