BookmarkSubscribeRSS Feed
Neeta
Fluorite | Level 6

Hi,

I'm trying to create demographics table. For alignment purpose I'm using a macro described in following paper. 

http://www.pharmasug.org/proceedings/2013/CC/PharmaSUG-2013-CC15.pdf

 

My problem is, I'm able to get aligned values in dataset but when I'm using proc report to output in ODS rtf, all the leading blanks, used for alignment are lost. I tried using other characters like << instead of blanks and it's working fine. Looks like only blanks has some problem. I also tried style(column)={asis=on}; but still its removing all leading blank spaces. 

 

Please help!

5 REPLIES 5
Ksharp
Super User
1) style(column)={pretext=' '}; 2) use TAB character '09'x instead of white blank . 3) use escapechar : data new; set have; column='~_~_~_~_'||column; run; ods escapechar='~'; proc report data=new nowd.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

 

This is something I do alot and asis=on should work fine.  Try the code below, make sure you have put the asis in the right place, and that the spaces are actually in the data - i.e. is there something triming or stripping the data&colon;

data have;
  a="Abcd"; output;
  a="  Defg"; output;
run;
ods rtf file="s:\temp\rob\tmp.rtf";
proc report data=have nowd;
  columns a;
  define a / style(column)={asis=on};
run;
ods rtf close;
crow
Fluorite | Level 6

HI!

This code will not work for RTF. ASIS=ON applicable for LISTING and HTML outputs.

Have a look at your tmp.rtf file.

 

BRGDS,

Crow

RW9
Diamond | Level 26 RW9
Diamond | Level 26

This code works exactly as it is intended producing the output shown in the picture

Capture.jpg

 

which is correct with spacing presented.  It is also widely documented as being used in RTF by other people such as:

https://www.lexjansen.com/phuse/2007/cs/CS08.pdf

 

Please avoid re-opening 3.5 year old threads just to post incorrect information.

ballardw
Super User

It may help to show  exactly how you made your data, some example data and the whole code for that example data that you attempted and what isn't quite working.

It would also help to show exactly how you would desire the output to look for the example data.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 5 replies
  • 5528 views
  • 1 like
  • 5 in conversation