BookmarkSubscribeRSS Feed
Obsidian | Level 7
Hello all,

I am a situation where i have dataset with two variables name and alias:

Name Alias
xxx_999_aa 999
vvv_156_bb 156

My requirement is to find the alias in the name,so as per below i need to find if 999 or 156 is present in names.I tried using the FIND function like the following;

data test;
set a;
if x > 0 then delete;
but this does not seems working as the value of the x is getting assigned as 0.

Please help
Super User
The alias might have trailing or leading blanks, and then you're searching for
' 999' or '999 ' rather than 999.

Try using the compress function on alias:

x=find(name, compress(alias));
y=find(name, alias);
Rhodochrosite | Level 12
without your log and contents it is hard to pinpoint. Some suggestions.

-- Make sure both variables are character.
-- Make sure the alias does not have either leading or trailing blanks in it (print alias with a hex format to see what SAS thinks is there).
-- You might try the code
to see if that helps.

Doc Muhlbaier
Obsidian | Level 7
Thank you all

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 3 in conversation