BookmarkSubscribeRSS Feed
Aexor
Lapis Lazuli | Level 10

Hi

I want to create a macro variable for all these title, title1 and title2 statement .
where price1,Line1 , 203 and 28.9 will come from separate macro variable

title1 'Predicted and actual values of price1';
title2 '(productLine = ''Line1'',
sale = 203,
price = 28.39
)';

 

Can anyone please help??

 

 

2 REPLIES 2
Kurt_Bremser
Super User
%let var1 = price1;
%let var2 = Line1;
%let var3 = 203;
%let var4 = 28.9;

title1 "Predicted and actual values of &var1.";
title2 "(productLine = '&var2.', sale = &var3., price = &var4.)";

Macro variables are not resolved in single quotes; single quotes within double quotes are just text and have no effect.

Always use double quotes in SAS code unless you specifically need single quotes.

PaigeMiller
Diamond | Level 26

Suggestion: simplify your coding and your titles and make titles more readable. Titles don't need parentheses around the information, and the single-quote or double-quote around LINE is not necessary either. Use actual ENGLISH words in your titles, properly capitalized, instead of variable names like productline

 

title2 "Product Line = &var2., Sale = &var3., Price = &var4.";


The whole point of a title is to convey information to an audience (who may not be computer programmers), if that audience speaks English then the title should be in English and not computerese.

--
Paige Miller

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1058 views
  • 1 like
  • 3 in conversation