I am attempting use read in a macro array that has the "%" special character in the text. I attempted using:
%let Med = %qscan(%nrbquote(&test1),&i.,9999);
which resolved most of the issues with characters such as ' or + etc.. but it did not work for the following character string:
5% SALINE+2%NAHCO399996.6%
What would you recommend when reading in the "%" special character in a text string?
One would question why a percent sign is even in the values. If you are manipulating data (macro language being a poor choice for that in general) then the percent sign mostly shouldn't be involved just the decimal form. If you are displaying data, (again not the best use of macro language) the format of a numeric value is likely what should place the % sign as humans really should be the only ones that care.
And even though there are some question uses of "macro array" there is no such actual supported structure by SAS.
Try %SQPERQ
%let Med = %qscan(%superq(test1),&i.,999);
Ksharp thanks for the response. %superq does not work in this circumstance. The log issued many error messages if superq was used and the program abended. %nrbquote issued several warnings but ran for the most part.
One would question why a percent sign is even in the values. If you are manipulating data (macro language being a poor choice for that in general) then the percent sign mostly shouldn't be involved just the decimal form. If you are displaying data, (again not the best use of macro language) the format of a numeric value is likely what should place the % sign as humans really should be the only ones that care.
And even though there are some question uses of "macro array" there is no such actual supported structure by SAS.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.