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.
Not sure if it matters, but Isn't there a cssstyle= rather than style= option for ODS HTML?
Hi Reeza,
Thanks for you reply. The HTML is the only output which is actually styled correctly dont want to change that.
Its the SAS Report that is not styled and the PDF which is really wrong.
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
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: