Hello everyone,
We want to capture symbol "&" from libname statement form user information along with username. As of now whole username is coming properly, but symbol & is not coming. We have used SAS character functions such as substr, find & scan to capture this.
Please look into below snippet for more clarity.
Please help to capture "&" from user= from libname statement.
Thanks!
Don't know if this is bullet proof, and there may be more elegant solutions:
scan(substr(a,findw(a, 'user', "'=")+4), 1, '=. ')
What is the context - where, when and how do you wish to capture this?
In SAS dataset, new column
Please post data as text, not in pictures. We can't copy pictures into the program editor window, but text works perfectly fine 😉
If you already have a dataset containing this information, please post it in a data step with datalines.
Apologies. Please find attached snippet of sample dataset. Requirement is in user column "&" should also come.
No snippet attached.
Don't know if this is bullet proof, and there may be more elegant solutions:
scan(substr(a,findw(a, 'user', "'=")+4), 1, '=. ')
Thank you! It worked well.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: