DATA Step, Macro, Functions and more

% STR Left align

Accepted Solution Solved
Reply
Contributor
Posts: 21
Accepted Solution

% STR Left align

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.


Accepted Solutions
Solution
‎09-12-2016 12:25 PM
PROC Star
Posts: 1,564

Re: % STR Left align

Since  ,age  is at the right place, the justification from %str is fine. 

So something else is wrong in your text string

 

View solution in original post


All Replies
Super User
Posts: 10,516

Re: % STR Left align

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?

PROC Star
Posts: 1,233

Re: % STR Left align

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.

Solution
‎09-12-2016 12:25 PM
PROC Star
Posts: 1,564

Re: % STR Left align

Since  ,age  is at the right place, the justification from %str is fine. 

So something else is wrong in your text string

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 304 views
  • 0 likes
  • 4 in conversation