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??
%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.
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.
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.
Ready to level-up your skills? Choose your own adventure.