The SAS Output Delivery System and reporting techniques

How do I create 2nd logo in my title

Accepted Solution Solved
Reply
Frequent Contributor
Frequent Contributor
Posts: 81
Accepted Solution

How do I create 2nd logo in my title

Hi Dear,

Here is my coding. I want the both output from Data _null_ and proc print to be print on the same  output page and want to print the company logo on the both title. My below coding print only one title. Can any body help me to print the second logo as well. Thanks very much in advance for your help.

Thanks

Inp 

data temp1;
input @1 x $30.;
cards;
mytestdata
;
run;

data temp2;
input @1 x $1.;
cards;
a
c
d
c
d
;
run;

ods pdf file="c:\mytest.pdf" startpage=no;
ods escapechar='^';
title  '^S={just=l preimage="c:\My_company_logo.gif"}';
OPTIONS FORMCHAR="|----|+|---+=|-/\<>*";
data _null_;
set temp1;
file print ods;
put _ods_;
run;

title  '^S={just=l preimage="c:\my_company_logo.gif"}';
proc print data=temp2;
run;
ods pdf close;


Accepted Solutions
Solution
‎10-27-2011 08:06 AM
SAS Super FREQ
Posts: 8,743

Re: How do I create 2nd logo in my title

Hi:

  In PDF world, SAS Titles go at the TOP of the page and only at the TOP of the page. That's because PDF is internally formatted to mimic a printed piece of paper (or multiple pieces of paper). If your second (or third) procedure/step has another TITLE statement, they are not inserted between output tables. This is the expected behavior. That is one reason why ODS TEXT= is used. It allows you to insert text BETWEEN tables, especially in an instance like this.

  Repeating a logo in the middle of the page might make the page seem cluttered. I've had students want logos only on the first page of a multi-page report, saying that they only needed the logo to appear once. Getting a logo in the middle of a page or between two tables has never come up until now -- for me, at least.

  Your only alternative is to move to using ODS TEXT= and if that doesn't give you what you want, then move to ODS LAYOUT to insert the logo multiple places on the page. The code below shows the use of ODS TEXT. My image is only about 1" by 1", so it doesn't take up too much real estate on the page. I worry that if the first table is big enough you could end up with logo-table-logo on page 1 and then the second procedure output on page 2 which might look odd. (Also, I took out the FORMCHAR option which shouldn't have any impact on ODS PDF output).

cynthia

options nodate nonumber;

   

ods listing close;

ods pdf file="c:\temp\usekermit.pdf" startpage=no;

ods escapechar='^';

title  '^S={just=l preimage="c:\temp\kermit.gif"}';

      

data _null_;

set sashelp.class(obs=4);

file print ods;

put _ods_;

run;

title;

  

ods text=  '^S={just=l preimage="c:\temp\kermit.gif"} ';

proc print data=sashelp.class(obs=3);

run;

ods pdf close;

View solution in original post


All Replies
Super Contributor
Posts: 318

How do I create 2nd logo in my title

Hi,

If I got your question right, you should use title2 for your 2nd title something like this.

title  '^S={just=l preimage="c:\My_company_logo.gif"}';

title2  '^S={just=l preimage="c:\My_company_logo2.gif"}';

Hope this helps.

Milton

Frequent Contributor
Frequent Contributor
Posts: 81

How do I create 2nd logo in my title

Hi Milton,

Thanks for your reply. but what I need is , want the print second logo right above the second report and below the first report.  If I put exactily the way you told me, it print both logo at the very top of the report.

Thanks

Inp

Super Contributor
Posts: 318

How do I create 2nd logo in my title

Hi,

Is this the way you want your report to look like?

Title

--First report goes here

Title

Logo2

--Second report goes here

If this is the case you put the title2 just before the second report, not on the first one. If I still visualized it wrong, hope you can attach a screenshot here so we'll get a clearer picture of what needs to be achieved. Smiley Happy

Thanks!

Frequent Contributor
Frequent Contributor
Posts: 81

Re: How do I create 2nd logo in my title

Hi

Yes your right which I need but it doesn't print  title2 when I put right above the proc print. Can you please check if some thing wrong with my coding. It doesn't print any title3 or title4 at the proc print. I am using latest SAS 9.2.

Thanks

Attached my output.

my output.gif

Super Contributor
Posts: 318

How do I create 2nd logo in my title

Hi,

I'm not quite sure why it happened like that. I also tried your code and got the same result. In my observation, it seems like it depends on the number of obs of your report.

Trial 1

- replaced temp1 with sashelp.shoes(contains a number or records)

- result: temp1 report along with title1, 2nd report on the last page, title1 and title2 for 2nd report did not appear like screenshot above.

Trial 2

-  replaced temp2 with sashelp.shoes

- result: 1st report on the first page along with title1, 2nd report on the next pages along with title1 and title2

I'm actually not sure of the behavior of ods. Maybe some experts in this forum can give the actual explanation. Smiley Happy

Milton

Solution
‎10-27-2011 08:06 AM
SAS Super FREQ
Posts: 8,743

Re: How do I create 2nd logo in my title

Hi:

  In PDF world, SAS Titles go at the TOP of the page and only at the TOP of the page. That's because PDF is internally formatted to mimic a printed piece of paper (or multiple pieces of paper). If your second (or third) procedure/step has another TITLE statement, they are not inserted between output tables. This is the expected behavior. That is one reason why ODS TEXT= is used. It allows you to insert text BETWEEN tables, especially in an instance like this.

  Repeating a logo in the middle of the page might make the page seem cluttered. I've had students want logos only on the first page of a multi-page report, saying that they only needed the logo to appear once. Getting a logo in the middle of a page or between two tables has never come up until now -- for me, at least.

  Your only alternative is to move to using ODS TEXT= and if that doesn't give you what you want, then move to ODS LAYOUT to insert the logo multiple places on the page. The code below shows the use of ODS TEXT. My image is only about 1" by 1", so it doesn't take up too much real estate on the page. I worry that if the first table is big enough you could end up with logo-table-logo on page 1 and then the second procedure output on page 2 which might look odd. (Also, I took out the FORMCHAR option which shouldn't have any impact on ODS PDF output).

cynthia

options nodate nonumber;

   

ods listing close;

ods pdf file="c:\temp\usekermit.pdf" startpage=no;

ods escapechar='^';

title  '^S={just=l preimage="c:\temp\kermit.gif"}';

      

data _null_;

set sashelp.class(obs=4);

file print ods;

put _ods_;

run;

title;

  

ods text=  '^S={just=l preimage="c:\temp\kermit.gif"} ';

proc print data=sashelp.class(obs=3);

run;

ods pdf close;

SAS Employee
Posts: 50

Re: How do I create 2nd logo in my title

Cynthia is correct.  Titles always go on top. Her example shows exactly how to do what you ask.  There are two things I want to bring up to better explain this situation:  (1) Titles will repeat on every page.  ODS TEXT= will not.  So what you see on page 1 will be correct but on page 2 you will only see the first logo at the top. (2) Cynthia mentions table sizes ... if the first table is big you could get into a situation where you get logo 1, table 1 and then logo 2 on page 1 but table 2 will be forced to page 2.  You really have to know your data and plan accordingly depending on table size.  If you just have 2 static tables and want images above then you should be okay.

Hope this helps!

Scott

Frequent Contributor
Frequent Contributor
Posts: 81

Re: How do I create 2nd logo in my title

Hi Cynthia,

Thanks very much. It resolved my problem. Accourding to my design, the logo is pretty much small and the data on all proc /output will be same number all the time.  But you solution is amazing. I have the book that you wrote ' Output Delivery  system , The basics and Beyond' . It is amaizing book. It does have the solution that you mention but I never thought of using ods text to bring the second logo in the report. you are so amazing.

Thanks very much Cynthia and Scott.

Regards

Inp

☑ This topic is SOLVED.

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

Discussion stats
  • 8 replies
  • 341 views
  • 0 likes
  • 4 in conversation