Issue with the "%" Special Character in a %qscan macro array

Accepted Solution Solved
Reply
anonymous_user
Posts: 0
Accepted Solution

Issue with the "%" Special Character in a %qscan macro array

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?


Accepted Solutions
Solution
Accepted by anonymous_user
‎12-08-2017 10:51 AM
Super User
Posts: 12,148

Re: Issue with the "%" Special Character in a %qscan macro array

Posted in reply to anonymous_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


All Replies
Super User
Posts: 10,313

Re: Issue with the "%" Special Character in a %qscan macro array

Posted in reply to anonymous_user

Try %SQPERQ

 

%let Med = %qscan(%superq(test1),&i.,999);
anonymous_user
Posts: 0

Re: Issue with the "%" Special Character in a %qscan macro array

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.

Solution
Accepted by anonymous_user
‎12-08-2017 10:51 AM
Super User
Posts: 12,148

Re: Issue with the "%" Special Character in a %qscan macro array

Posted in reply to anonymous_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.

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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