splitting a string

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

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: 9,856

Re: splitting a string

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

View solution in original post


All Replies
Solution
‎07-25-2015 07:23 AM
Super User
Posts: 9,856

Re: splitting a string

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

Contributor
Posts: 27

Re: splitting a string

Thank u Xia.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 204 views
  • 0 likes
  • 2 in conversation