Solved
Contributor
Posts: 35

# splitting a string

data students;

input name \$ 11. street \$ 20. city \$ 13. state \$  county\$ 10.;

cards;

alvarez, N   anystreet av 541    princeton   nj

brodsky, b   somestreet ter 919  raleigh     nc wake

burke, r     anylane ave 45      southfield  ma

cross, j     somelane rd 12-4   farmington  nc brunswick

davito, f    n anyroad pl 1056   high point  nc davidson

fleming, j   somedrive st 212    chapel hill nc orange

kirby, n    anyplace apt 8 9    santa fe    nm

love, t      anycircle ct 770    durham      nc durham

murray, p    anydrive rd 923     weston      ca

;

run;

i need new variable street_number from street like this

541

919

45

12-4

1056

9

770

923

anyplace apt8 is stree and 9 is Street_number.

can anyone solve this?

thank u.

Accepted Solutions
Solution
‎07-25-2015 07:23 AM
Super User
Posts: 10,787

## Re: splitting a string

street_number=scan(street ,-1,' ') ;

All Replies
Solution
‎07-25-2015 07:23 AM
Super User
Posts: 10,787

## Re: splitting a string

street_number=scan(street ,-1,' ') ;

Contributor
Posts: 35

## Re: splitting a string

Thank u Xia.

🔒 This topic is solved and locked.