BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JasonNC
Quartz | Level 8

Hi,

I want to print the data using ODS PDF TEXT in Proc report

At present i am using

ODS PDF TEXT="~S={JUST=C FONT_SIZE=8pt FONT_FACE='Courier New' }* START *"

Instead of using Just=C or L or R i want to print it where ever i want.

I tried different options like spaces but it didn't work out.

Can some body let me know ASAP.

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  Putting "End of Report" is not hard. You could do it in PROC REPORT with a COMPUTE AFTER block and a LINE statement (if your main report is PROC REPORT) or you can do it with ODS PDF TEXT= if your procedure is something else (like PROC FREQ or PROC MEANS, etc).

  However, with TEXT= you are pretty much limited to Left, Center, Right justification, unless you pad your text string with non-breaking spaces and then turn ASIS=ON...but there is still no guarantee that the text string will be EXACTLY where you want it. I'm still not grasping why L, R or C is not adequate, though -- and there's always LEFTMARGIN and RIGHTMARGIN to help you out. Output below produced with SAS 9.3 on Windows. 

  The still-experimental DATA step interface and ODS REGION/ODS LAYOUT might do something for you, but it seems like a lot of work for "End of Report".

    

cynthia

** make some macro variables to use later;

%let j1 = Twas brillig and the slithy toves,;

%let j2 = Did gyre and gimble in the wabe.;

%let j3 = All mimsy were the borogroves,;

%let j4 = And the mome raths outgrabe.;

%let j5 = Beware the Jabberwock my son,;

%let j6 = The jaws that bite the claws that snatch.;

%let j7 = Beware the Jubjub bird and shun,;

%let j8 = The frumious Bandersnatch.;

 

ods pdf file='c:\temp\odstext.pdf' startpage=no notoc;

ods escapechar='^';

 

proc report data=sashelp.class(obs=3) nowd;

  compute after /style={just=l leftmargin=3in};

    line 'End of Report';

  endcomp;

run;

    

ods pdf text='^S={leftmargin=.25in}Line 1';

ods pdf text='^S={leftmargin=.50in}Line 2';

ods pdf text='^S={leftmargin=.75in}Line 3';

ods pdf text='^S={leftmargin=1.00in}Line 4';

ods pdf text='^S={leftmargin=1.25in}Line 5';

ods pdf text='^S={leftmargin=1.50in}Line 6';

ods pdf text='^S={leftmargin=1.75in}Line 7';

ods pdf text='^S={leftmargin=2.00in}Line 8';

ods pdf text='^S={leftmargin=2.25in}Line 9';

ods pdf text='^S={leftmargin=2.50in}Line 10';

ods pdf text='^S={leftmargin=2.75in}Line 11';

ods pdf text='^S={leftmargin=3.00in}Line 12';

ods pdf text='^S={leftmargin=3.25in}Line 13';

ods pdf text='^S={leftmargin=3.50in}Line 14';

ods pdf text='^S={leftmargin=3.75in}Line 15';

ods pdf text='^S={leftmargin=4.00in}Line 16';

ods pdf text="^S={leftmargin=2.50in rightmargin=1.0in}&j1 &j2 &j3 &j4 &j5 &j6 &j7 &j8";

 

ods pdf close;


odstext_pdf.jpg

View solution in original post

4 REPLIES 4
Cynthia_sas
SAS Super FREQ

Hi:

  I think I understand what you mean by "I want to print it where ever I want" -- In the "old" days, when people were using the LISTING destination (or Output window), you could use DATA _NULL_ to create "free-format" reports because you could treat the entire "page" like a piece of graph paper, with each block or cell in the graph paper representing 1 print position for 1 character. However, that concept of "free-format" reports only applied to the LISTING window, because it was a "monospace" font destination, where the letter i took up as much space as the letter w...for example:

Proportional spaced font:

iiiiiiiiiiiiiiiiiiii

wwwwwwwwwwwwwwwwwwww

aaaaaaaaaaaaaaaaaaaa

"Monospace" font, like Courier New or SAS Monospace:

iiiiiiiiiiiiiiiiiiii

wwwwwwwwwwwwwwwwwwww

aaaaaaaaaaaaaaaaaaaa

  If  you look at the above example, in the monospace font, the 3rd character "lines up" one above the other, no matter whether the character is an i or a or  w. But, in the proportional spaced font the letters do NOT line up because that is a feature of proportional spaced fonts -- each letter takes up a variable amount of space determined by the font characteristics.

  With ODS TEXT=, your only choices really are L, R or C.

  Without seeing some kind of example of what you are trying to create, it's hard to give you better advice. Do you need a table? Do you need free-format text? Do you need a letter?  Perhaps these Tech Support notes and papers and examples will help put things in context.

http://support.sas.com/kb/25/426.html

http://support.sas.com/kb/25/425.html

http://support.sas.com/kb/25/429.html

http://www2.sas.com/proceedings/sugi30/088-30.pdf

http://support.sas.com/kb/5/486.html

http://support.sas.com/kb/9/981.html

http://support.sas.com/kb/24/493.html

http://www.lexjansen.com/pnwsug/2007/Richard%20Koopmann%20-%20Experimenting%20with%20the%20ODS%20DAT...

http://www2.sas.com/proceedings/forum2008/261-2008.pdf

http://www.wuss.org/proceedings09/09WUSSProceedings/papers/app/APP-OConnor.pdf

cynthia

JasonNC
Quartz | Level 8

Hi Cynthia,

I want to print it as a free format text.On my pdf report i am printing it.

Like when pdf report ends i am using ODS PDF Text to print End of Report

Cynthia_sas
SAS Super FREQ

Hi:

  Putting "End of Report" is not hard. You could do it in PROC REPORT with a COMPUTE AFTER block and a LINE statement (if your main report is PROC REPORT) or you can do it with ODS PDF TEXT= if your procedure is something else (like PROC FREQ or PROC MEANS, etc).

  However, with TEXT= you are pretty much limited to Left, Center, Right justification, unless you pad your text string with non-breaking spaces and then turn ASIS=ON...but there is still no guarantee that the text string will be EXACTLY where you want it. I'm still not grasping why L, R or C is not adequate, though -- and there's always LEFTMARGIN and RIGHTMARGIN to help you out. Output below produced with SAS 9.3 on Windows. 

  The still-experimental DATA step interface and ODS REGION/ODS LAYOUT might do something for you, but it seems like a lot of work for "End of Report".

    

cynthia

** make some macro variables to use later;

%let j1 = Twas brillig and the slithy toves,;

%let j2 = Did gyre and gimble in the wabe.;

%let j3 = All mimsy were the borogroves,;

%let j4 = And the mome raths outgrabe.;

%let j5 = Beware the Jabberwock my son,;

%let j6 = The jaws that bite the claws that snatch.;

%let j7 = Beware the Jubjub bird and shun,;

%let j8 = The frumious Bandersnatch.;

 

ods pdf file='c:\temp\odstext.pdf' startpage=no notoc;

ods escapechar='^';

 

proc report data=sashelp.class(obs=3) nowd;

  compute after /style={just=l leftmargin=3in};

    line 'End of Report';

  endcomp;

run;

    

ods pdf text='^S={leftmargin=.25in}Line 1';

ods pdf text='^S={leftmargin=.50in}Line 2';

ods pdf text='^S={leftmargin=.75in}Line 3';

ods pdf text='^S={leftmargin=1.00in}Line 4';

ods pdf text='^S={leftmargin=1.25in}Line 5';

ods pdf text='^S={leftmargin=1.50in}Line 6';

ods pdf text='^S={leftmargin=1.75in}Line 7';

ods pdf text='^S={leftmargin=2.00in}Line 8';

ods pdf text='^S={leftmargin=2.25in}Line 9';

ods pdf text='^S={leftmargin=2.50in}Line 10';

ods pdf text='^S={leftmargin=2.75in}Line 11';

ods pdf text='^S={leftmargin=3.00in}Line 12';

ods pdf text='^S={leftmargin=3.25in}Line 13';

ods pdf text='^S={leftmargin=3.50in}Line 14';

ods pdf text='^S={leftmargin=3.75in}Line 15';

ods pdf text='^S={leftmargin=4.00in}Line 16';

ods pdf text="^S={leftmargin=2.50in rightmargin=1.0in}&j1 &j2 &j3 &j4 &j5 &j6 &j7 &j8";

 

ods pdf close;


odstext_pdf.jpg
JasonNC
Quartz | Level 8

Thanks cynthia that was helpful

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 8079 views
  • 1 like
  • 2 in conversation