BookmarkSubscribeRSS Feed
metallon
Pyrite | Level 9

Hi Guys,

I got the following SAS code:

options nodate pageno=1 linesize=80 pagesize=40 obs=10;

proc template;

/*HTML Style*/

define style styles.mycssstyle;

    import "H:\SAS Makro\BVL_SASStyle_29012015_v1.css";

end;

/*PDF Style*/

define style styles.mycssstyleprinter;

        parent=styles.mycssstyle;

        import "H:\SAS Makro\BVL_SASStyle_29012015_v1.css" print;

end;

run;

/*HTML*/

ods html file="H:\SAS Output Test\css.html" style=styles.mycssstyle;

/*PDF*/

ods pdf file="H:\SAS Output Test\css.pdf" style=styles.mycssstyleprinter;

/*SAS*/

proc contents data=sashelp.class;

run;

ods _all_ close;

The CSS is attached.

Two question.

1. my PDF output is totally odd, its 80 pages and massive letters, unreadable. why is that?

2. the SAS Report that the EG generated along the HTML and PDF is not styled, why is that?

It would be great if someone can share some insight. Its the first time I am using CSS together with SAS. I like the idea

I just need to learn how far it can be used to style SAS outputs.

4 REPLIES 4
Reeza
Super User

Not sure if it matters, but Isn't there a cssstyle= rather than style= option for ODS HTML?

metallon
Pyrite | Level 9

Hi Reeza,

Thanks for you reply. The HTML is the only output which is actually styled correctly Smiley Happy dont want to change that.

Its the SAS Report that is not styled and the PDF which is really wrong.

Cynthia_sas
SAS Super FREQ

Hi:

  So the HTML could look OK because you chose relative numbers for font sizes which is totally fine for HTML, but forces PDF to do a conversion from relative sizes to absolute PT sizes. I do not believe that the SAS Report XML - -such as that used by Web Report student or Enterprise Guide will use your all your CSS. For example, if you want to use a custom CSS file with Web Report Studio (and SAS Report format), you have to define your CSS file in the XML used by Web Report Studio. Also, it looks like you are importing the SAME CSS file into 1 style for PDF and another style for HTML and, granted, you are using a media type for the PDF style, but still, given that you've got a PARENT= and an IMPORT, I'm not sure how conflicting selectors would resolve. This seems a better question for Tech Support.

  And, Reeza is correct, you could use your CSS file directly with either HTML, RTF or PDF by just specifying the CSSSTYLE= option, so I'm not sure you gain anything by importing the CSS file into a template.

cynthia

metallon
Pyrite | Level 9

Hi Cynthia!

Thanks for your reply. My gain by using an external CSS file is re-use of already

existing assets within the organization. I try to avoid re-capsuling into SAS.

When I can use the external CSS file within SAS than that is super great and I am happy.

Thanks for pointing out that the PDF conversion converts my relative pixel size to actual PT sizes.

That explains the mess up in the PDF output.

Furthermore. You are right. I use the SAME CSS file for PDF and HTML. That is really just for test purposes.

Thanks

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
  • 1703 views
  • 1 like
  • 3 in conversation