SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
abhinayingole
Obsidian | Level 7

 

 

Hi...

 

I am working on AE table.

working on SAS studio.

 

I need to place 3 blank spaces before "Preferred Term" in column header (screen print below).

but, macro variable with blank space is not working with SAS studio, also with "\li300" option.... "System Organ Class" also move 3 space left.

 

 

any suggestion please.

 

abhinayingole_0-1642172112425.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data have;
do i=1 to 20;
col='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
output;
end;
stop;
 keep col;
run;


ods rtf file='c:\temp\temp.rtf' style=journal bodytitle;
proc report data =have nowd split = '#'  ;
column col ;
define col / 'System Organ Class#   Preferred Term' style(header)={just=l asis=on} ;
run;
ods rtf close

Ksharp_0-1642424172229.png

 

View solution in original post

5 REPLIES 5
ballardw
Super User

Proc report code as a minimum as we need to know all the options you are currently using that might affect that appearance.

Better is to include example data in the form of a data step as well so we can actually test code suggestions.

 

Any code that includes macro variables needs to include the definition/values of the macro variables. And did you have code that worked as desired before adding in macro variables? If not, then the macro variables adds complexity to the problem.

 

Please not that "indent 3 spaces" is 1) very flexible in meaning as proportional fonts display spaces at different widths and 2) do you mean to have the second bit centered?

r_behata
Barite | Level 11

I am not sure if there is any option in Proc report that aligns column headers as per your requirement.

 

However, there is a workaround , which I find quite handy -

 

Inserting Invisible characters in the program code, to adjust the header 3 spaces left - Press and hold “Alt” key and while holding it, type digit keys 255 at the numeric keypad . The inserted characters will be exactly like blank spaces (Repeat 3 times in your case) . The report output will honor them as valid characters and display them as spaces.

 

https://www.lexjansen.com/nesug/nesug04/pm/pm24.pdf

 

 

 

ballardw
Super User

@r_behata wrote:

I am not sure if there is any option in Proc report that aligns column headers as per your requirement.

 

However, there is a workaround , which I find quite handy -

 

Inserting Invisible characters in the program code, to adjust the header 3 spaces left - Press and hold “Alt” key and while holding it, type digit keys 255 at the numeric keypad . The inserted characters will be exactly like blank spaces (Repeat 3 times in your case) . The report output will honor them as valid characters and display them as spaces.

 

https://www.lexjansen.com/nesug/nesug04/pm/pm24.pdf

 

 

 


To force where the label goes to the second line would also likely require the SPLIT option character. Still say we need to see the existing Proc Report code to make sure this is viable. Note the phrase in the question:

but, macro variable with blank space is not working with SAS studio, also with "\li300" option.... "System Organ Class" also move 3 space 

Macro variable(s) where of what content, the "\li300" appears to be attempting to use RTF (?) raw codes and not clue what "System Organ Class" refers to. There is a lot stuff possible in the code that we would need to see.

abhinayingole
Obsidian | Level 7

proc report data = &data. headline nowd split = '#' missing ps=30
style ( report )= [frame=hsides rules=groups outputwidth=9in background = white ]
style ( header ) = [ protectspecialchars = off] nowindows ;
column fcol ;

by pgby;

define fcol / "System Organ Class# Preferred Term"
style = [ just = left cellwidth = 0.9in protectspecialchars = off background = white ]
style ( header ) = [ just = left ] ;






This piece of code I am using.
Ksharp
Super User
data have;
do i=1 to 20;
col='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
output;
end;
stop;
 keep col;
run;


ods rtf file='c:\temp\temp.rtf' style=journal bodytitle;
proc report data =have nowd split = '#'  ;
column col ;
define col / 'System Organ Class#   Preferred Term' style(header)={just=l asis=on} ;
run;
ods rtf close

Ksharp_0-1642424172229.png

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3327 views
  • 2 likes
  • 4 in conversation