DATA Step, Macro, Functions and more

Proc print - Center justify column heading

Accepted Solution Solved
Reply
Contributor
Posts: 26
Accepted Solution

Proc print - Center justify column heading

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


Accepted Solutions
Solution
‎08-09-2013 02:03 PM
SAS Super FREQ
Posts: 8,862

Re: Proc print - Center justify column heading

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


All Replies
Respected Advisor
Posts: 3,799

Re: Proc print - Center justify column heading

What code?

Contributor
Posts: 26

Re: Proc print - Center justify column heading

Posted in reply to data_null__

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

Solution
‎08-09-2013 02:03 PM
SAS Super FREQ
Posts: 8,862

Re: Proc print - Center justify column heading

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
Contributor
Posts: 26

Re: Proc print - Center justify column heading

Posted in reply to Cynthia_sas

Thank you, my code works now!

🔒 This topic is solved and locked.

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

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