Hi,
I have a macro call where I use the %STR option. This call corresponds to a macro variable that I use with t.format_text in RWI. When I get the output in pdf, the start of the text is left aligned but the macro call reolves to be center aligned. How do I overcome this?
My code looks like:
t.format_text (text: "^{super[3]} text text text &var"
, style_attr: "font_size=10pt font_style=roman just=left font_weight=medium");
run;
The macro call looks like this:
%table(x,y,z, %STR( , age group (<16 years or >=16 years), gender (Male or Female).), a);
The output looks like:
[3]text text text text ........................... text, age
group (<16 years or >=16 years), gender (Male or Female).
How do I get rid of the space on the left in the second line of text?
Thanks.
Since ,age is at the right place, the justification from %str is fine.
So something else is wrong in your text string
Can you show more of what your %table macro does? Is there anyplace before the displayed text that the macro language manipulates the variable &var? And is there any chance one or more TAB characters are embedded in the call to %table?
Yes, please show more of your macro. Or show a simplified version that can replicate the problem.
I don't know ODS Report Writing Inteface, but I don't think the problem is the macro language. For example, this works fine:
1 %macro table(x,y,z,var,a); 2 %put text text text &var; 3 %mend table; 4 %table(x,y,z, %STR( , age group (<16 years or >=16 years), gender (Male or Female).), a); text text text , age group (<16 years or >=16 years), gender (Male or Female).
I would back out of the macro, and instead try a RWI step where you just hardcode the long text string. And see how it wraps, etc. Could be some sort of hanging indent or tab or whatever. Try to get a simple data step example working without macro code, then once you've done that, come back to the macro language to generate the data step code.
If the data step code works like you want but the macro language generates data step code that does not work the same way, that would be surprising (and interesting). If that happens, please post the example of the working data step code and the non-working macro code, and more folks will be able to help you investigate potential causes.
Since ,age is at the right place, the justification from %str is fine.
So something else is wrong in your text string
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.