BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
analyst_work
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

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

3 REPLIES 3
ballardw
Super User

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?

Quentin
Super User

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.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
ChrisNZ
Tourmaline | Level 20

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

So something else is wrong in your text string

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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