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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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