DATA Step, Macro, Functions and more

How to select Second name from full name and from address

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

How to select Second name from full name and from address

[ Edited ]

Hi,

 

Q1 Below there is a list of names and i want to select only second names from the list.

 

Alan Schoenberg

Alan Barnes

Alex Russell

Amy Cox

Amy Hunt

Andy Gerbode

Benjamin Patter

Clytie Kelty

Julie Kriz

Liz Price

Robert Waldorf

Marina Lichtens

 

Q2 From the full address i want to select only second name the data is in miss mode

 

Alan Schoenberg, Ontario, United States of America 

Alan Barnes, United States of America 

Benjamin Patter, Australia

Clytie Kelty, Denmark

Julie Kriz,West, British Columbia

Liz Price,Northwest Territories, United States of America 

Robert Waldorf, United Kingdom

Marina Lichens, California, United States of America 

 

Q3 Below Product Name has been listed and i want only those observation in output if Product Name have Chair and Machine 

 

Staples Colored Bar Computer Paper

Office Star - Ergonomic Mid Back Chair with 2-Way Adjustable Arms

Bevis 36 x 72 Conference Tables

Global Leather Task Chair, Black

Bush Advantage Collection® Round Conference Table

Global Stack Chair without Arms, Black

Office Star - Ergonomic Mid Back Chair with 2-Way Adjustable Arms     

Global Leather Task Chair, Black

GBC DocuBind 200 Manual Binding Machine 

Staples® General Use 3-Ring Binders Machine

 


Accepted Solutions
Solution
‎09-01-2016 12:26 PM
Frequent Contributor
Posts: 104

Re: How to select Second name from full name and from address

[ Edited ]

Q1: scan(name,2)
Q2: scan(fullAddress,2)
Q3: indexc(lowcase(productName),'chair','machine')>0

________________________

- Cheers -

View solution in original post


All Replies
Solution
‎09-01-2016 12:26 PM
Frequent Contributor
Posts: 104

Re: How to select Second name from full name and from address

[ Edited ]

Q1: scan(name,2)
Q2: scan(fullAddress,2)
Q3: indexc(lowcase(productName),'chair','machine')>0

________________________

- Cheers -

Occasional Contributor
Posts: 13

Re: How to select Second name from full name and from address

Awesome 1st and 2nd question i got answer but 3rd question i think sum thing missing i not getting exact output answer. but ur answers are perfect. Thanks’ a Lot.

Super User
Posts: 17,963

Re: How to select Second name from full name and from address

This looks a lot like homework/learning exercise so you should give it a shot. There are some hints below on functions you can use.  

 

Q1 - Scan

Q2 - I don't understand the question

Q3 - Find or Index function 

Occasional Contributor
Posts: 13

Re: How to select Second name from full name and from address

Thank You even ur answer are right. Smiley Wink

Super User
Posts: 10,552

Re: How to select Second name from full name and from address

[ Edited ]

Names are obnoxious data. The question might be do you want the Last (family) name or the second word. Consider:

Pierre Le Blanc

Dick Van Dyke

Jorge De La Cruz

 

Which piece to you want from those?

 

Again since this is apparently an exercise there are a number of functions that may come into play:

Index, Scan, Find, FindW, IndexW

are likely candidates.

 

 

☑ This topic is solved.

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

Discussion stats
  • 5 replies
  • 251 views
  • 0 likes
  • 4 in conversation