Search for a hyphen from the first name only
If I have a dataset containing many names, such as "Steve Jobs", how can I search for names that have a hyphen in the first name only using the proc print command?
Example: Dataset ex1 contains
name
--------
Steve Jobs
Steve Job-s <- I do not want this
Ste-ve Jobs <- I want this
The code I have written is the following
proc print data=ex1 noobs split=' ';
where name like '%-%';
run;
My code will print "Steve Job-s" and "Ste-ve Jobs". What can I do to stop "Ste-ve Jobs"?
+3
source to share