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

Hello all,

I have done a bit of search on how to left/center/right justify column headings in proc print but haven't found much... I have found 'Style' and 'Justify' but neither seem to work in my code.

Please let me know if you know how this can be done.

Many thanks Smiley Happy

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  I do not see any code where you have actually TRIED style= with justification overrides. Can you try a report using SASHELP.CLASS and see whether your STYLE override works? For example, the code below justifies correctly (and changes colors correctly) for me. I made the report wide so you could REALLY see the impact of the justification.

cynthia

ods _all_ close;
ods html file='c:\temp\print_just.html' style=sasweb;

proc print data=sashelp.class(obs=3)
  style(header)={just=c foreground=black}
  style(table)={width=100%};
  title 'Make the report very wide to see justification';
  var name / style(data)={just=r}
             style(header)={background=pink};
  var age / style(data)={just=l};
  var sex height / style(data)={just=c}
                   style(header)={background=yellow};
  var weight / style(data)={just=l};
run;
ods html close;


HTML_just.png

View solution in original post

4 REPLIES 4
data_null__
Jade | Level 19

What code?

Shirin
Obsidian | Level 7

It's a simple proc print outputing to HTML.... it looks something like this:

ods html file="**********";

proc print data= **********%scan(&FEDs.,&i.)_c9 (drop=NEW_ED_Code OLD_ED_Code) split="*" noobs;

Title1 "&&FEDPr&i.";

Footnote1 "**********";

label  **********;

format **********.;

run;

ods html close;

Thanks Smiley Happy

Cynthia_sas
SAS Super FREQ

Hi:

  I do not see any code where you have actually TRIED style= with justification overrides. Can you try a report using SASHELP.CLASS and see whether your STYLE override works? For example, the code below justifies correctly (and changes colors correctly) for me. I made the report wide so you could REALLY see the impact of the justification.

cynthia

ods _all_ close;
ods html file='c:\temp\print_just.html' style=sasweb;

proc print data=sashelp.class(obs=3)
  style(header)={just=c foreground=black}
  style(table)={width=100%};
  title 'Make the report very wide to see justification';
  var name / style(data)={just=r}
             style(header)={background=pink};
  var age / style(data)={just=l};
  var sex height / style(data)={just=c}
                   style(header)={background=yellow};
  var weight / style(data)={just=l};
run;
ods html close;


HTML_just.png
Shirin
Obsidian | Level 7

Thank you, my code works now!

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
  • 4 replies
  • 18202 views
  • 3 likes
  • 3 in conversation