BookmarkSubscribeRSS Feed
DmytroYermak
Lapis Lazuli | Level 10

Hi all,

 

Could please help to mask the variables Cavg(ss) and AUC_%Extrap_obs  in the text of macros:

...
%if &ppfile=pksc %then %do;
  Cavg(ss)
  AUC_%Extrap_obs;
%end;

Thank you!

 

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

https://v8doc.sas.com/sashtml/macro/z3514str.htm

 

Seriously though, if your having to use these, do you not think there are better ways of working, because there are, many options.  Macro is not a replacement for base SAS, it just makes long winded unmaintainable code which someone has to come in and delete at some point.  

Tom
Super User Tom
Super User

Can you explain what this snippet of code is trying to do?

Cavg(ss) and AUC_%Extrap_obs are not valid variable names. If those a really your variable names you can reference them with name literals.

'Cavg(ss)'n 
'AUC_%Extrap_obs'n

If that is just text then look at macro quoting functions like %STR().

%str(Cavg%(ss%)) 
%str(AUC_%%Extrap_obs)
DmytroYermak
Lapis Lazuli | Level 10

Yes, they are not valid variables names in SAS but they are the names of variables in xlsx file that is read as sas library. 

Tom
Super User Tom
Super User

@DmytroYermak wrote:

Yes, they are not valid variables names in SAS but they are the names of variables in xlsx file that is read as sas library. 


So just use name literals to refer to the variable names.  Make sure to use single quotes and not double quotes when constructing the name literals so that the macro processor does not try to act on the macro triggers, & or %, that might occur in the variable names.

DmytroYermak
Lapis Lazuli | Level 10

I have found this link: it seems that 'do' cycle is needed as well as double ampersant - https://support.sas.com/resources/papers/proceedings13/005-2013.pdf . In my understanding it is not ordinary task to force SAS to stop re-scan in searching of macrotriggers. Especially if a program have several ones/levels. I have no final decision yet.

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 908 views
  • 0 likes
  • 3 in conversation