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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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
  • 368 views
  • 0 likes
  • 3 in conversation