DATA Step, Macro, Functions and more

separating word or words from string

Accepted Solution Solved
Reply
Regular Contributor
Posts: 215
Accepted Solution

separating word or words from string

Hi All,

I have the following table with one variable call 'FullEntry'.  

 

FullEntry

khafiz (Kula Hafiz - Assistant Director, Vancouver, BC)
jthompson (Jill Thompson - Senior Education Officer, New York, NY)
tkewen (Tom John Kewen - Office Assistant, Los Angeles, CA)

 

I want to separate it out as follows. Can someone help please.

 

 

USER_ID          Name                 Position                                  City               State

 

khafiz               Kula Hafiz           Assistant Director                  Vancouver      BC
jthompson       Jill Thompson      Senior Education Officer       New York        NY
tkewen            Tom John Kewen  Office Assistant                     Los Angeles   CA


Accepted Solutions
Solution
‎01-15-2017 10:07 AM
Trusted Advisor
Posts: 1,374

Re: separating word or words from string

separate by SCAN() using delimiter '()-,':

  USER_ID = scan(FullEntry,1,'()-,');

  Name      = scan(FullEntry,2,'()-,');     

  Position  = scan(FullEntry,3,'()-,');   

  City         = scan(FullEntry,4,'()-,'); 

 State        = scan(FullEntry,5,'()-,'); 

     

View solution in original post


All Replies
Solution
‎01-15-2017 10:07 AM
Trusted Advisor
Posts: 1,374

Re: separating word or words from string

separate by SCAN() using delimiter '()-,':

  USER_ID = scan(FullEntry,1,'()-,');

  Name      = scan(FullEntry,2,'()-,');     

  Position  = scan(FullEntry,3,'()-,');   

  City         = scan(FullEntry,4,'()-,'); 

 State        = scan(FullEntry,5,'()-,'); 

     

☑ This topic is SOLVED.

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

Discussion stats
  • 1 reply
  • 145 views
  • 2 likes
  • 2 in conversation