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

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Oligolas
Barite | Level 11

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

________________________

- Cheers -

View solution in original post

5 REPLIES 5
Oligolas
Barite | Level 11

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

________________________

- Cheers -

Prashant_Ph
Fluorite | Level 6

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.

Reeza
Super User

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 

Prashant_Ph
Fluorite | Level 6

Thank You even ur answer are right. Smiley Wink

ballardw
Super User

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.

 

 

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 1214 views
  • 0 likes
  • 4 in conversation