BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jacob_klimek
Obsidian | Level 7

Hello,

 

I have a dataset with a bunch of addresses, unfortunately they are all combined into one line and I need to parse out everything that comes after the person's name into one line.

 

Data that I have:

 

id         Name               address_line                                              city_state         zipcode

1          John Doe          john doe 123 Central Avenue                 New York, NY    12345

 

Data I want:

id         Name               address_line_1                                          city_state         zipcode

1          John Doe         123 Central Avenue                                 New York, NY    12345

 

 

I know I probably have to use index and substring or some combination of those, but I really have no idea where to start.

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

That looks like the right set of tools, but I think you are looking for this:

 

address_line_1 = substr(address_line, length(name) + 2);

View solution in original post

2 REPLIES 2
Reeza
Super User

Use the length of name as the second argument to substr function. It tells it where to start the substr and leaving out the third parameter tells it to take the rest of the string. 

 

Address = substr(address_line1, length(name));
Astounding
PROC Star

That looks like the right set of tools, but I think you are looking for this:

 

address_line_1 = substr(address_line, length(name) + 2);

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 761 views
  • 0 likes
  • 3 in conversation