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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

 

View solution in original post

3 REPLIES 3
Ksharp
Super User

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.

ballardw
Super User

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 647 views
  • 0 likes
  • 3 in conversation