Dr.Ed Rogers.
=========================================================================
Date: Mon, 17 Feb 2003 13:01:13 +0100
Reply-To: WIELKI Andre <wielki@INED.FR>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: WIELKI Andre <wielki@INED.FR>
Subject: Re: graph/fonts/ods (yet more)
In-Reply-To: <174644FE9419C04BA608831C044C36397AD7@pwserver5.pwcons.com>
Content-Type: text/plain; charset="iso-8859-1"; format=flowed
Frank,
Thanks for the little correction about the use of the fonts name inside
Joe'(corrected by me)code.
Indeed it is working better (see his post at the end).
About CALL DEFINE... i think the start paper of all the tried solutions on
sas-l is
Proc report:doin'it in Style by Ray Pass and Sandy McNeil(of SI)
It also take time to discover it (perhaps because i am not a great user of
proc report)
Joe Kelley was writing to me
"I just printed the output and the font inside the graphic is still bad.
The screen version looks ok. It does not appear that truetype fonts will
be used inside a printed graph. I am printing this from Word (and it
seems to be fine in Word). It appears that by the time I have the graph,
the whole thing is just an image, not an image + text. So the problem
starts with what is created by the gout= file. "
Finally i don't think 'activex' would be an acceptable solution
because the graph went on a page alone
For having perfect fonts, the solution ods pdf... seems better even if you are
limited to Times Courrier and Helvetica
See here , Joe, the same test with your code in pdf
ods listing close;
proc format library=work ;
value SevFmt 0 = 'Informative'
1 = 'Low'
2 = 'Medium'
3 = 'High' ;
run;
data TestData(keep= Aid Serious k1-k4 Omit test rx)
IDz(keep=AID Omit test rx);
do id = 1 to 1000 ;
Aid = compress('I'||put(id,z4.));
rx = ranuni(0) ;
rx1 = ranuni(0) ;
rx2 = ranuni(0) ;
rx3 = ranuni(0) ;
rx4 = ranuni(0) ;
test = 0*(rx <= .4) + 1 * (rx > .4);
output IDz ;
if test then do ;
k1=. ; k2 =.; k3 = . ; k4 = . ;
k1 = 0 * (rx1 <= .2) + 2 * (.2 < rx1 <= .4) +
4 * (.4 < rx1 <= .6) + 5 * (.6 < rx1 <= .8) +
6 * (.8 < rx1 <= 1.0);
do i = 1 to k1 ;
Serious = 0 ;
output TestData;
end ;
serious=. ;
k2 = 0 * (rx2 <= .2) + 0 * (.2 < rx2 <= .4) +
2 * (.4 < rx2 <= .6) + 3 * (.6 < rx2 <= .8) +
4 * (.8 < rx2 <= 1.0);
do i = 1 to k2 ;
Serious = 1 ;
output TestData;
end ;
serious=. ;
k3 = 0 * (rx3 <= .2) + 0 * (.2 < rx3 <= .4) +
0 * (.4 < rx3 <= .6) + 2 * (.6 < rx3 <= .8) +
4 * (.8 < rx3 <= 1.0);
do i = 1 to k3 ;
Serious = 2 ;
output TestData;
end ;
serious=. ;
k4 = 0 * (rx4 <= .2) + 0 * (.2 < rx4 <= .4) +
0 * (.4 < rx4 <= .6) + 3 * (.6 < rx4 <= .8) +
4 * (.8 < rx4 <= 1.0);
do i = 1 to k4 ;
Serious = 3 ;
output TestData;
end ;
serious=. ;
end ;
else if ^test then do;
omit=1;
* if (k1 + k2 + k3 + k4 EQ 0 ) then serious = . ;
* put _ALL_ ;
output TestData;
end ;
end ;
format serious SevFmt. ;
run;
proc freq data=TestData noprint ;
tables Aid / out=ZR_1(drop=percent) ;
run;
data _NULL_ ;
set ZR_1 nobs=N_Obs end=last;
call symput("N_Obs1",compress(put(N_Obs,comma9.)) );
stop ;
run;
proc freq data=TestData noprint ;
where Serious in(0 1 2 3);
tables Aid*Serious / out=x1(drop=percent) ;
run;
data x1;
set x1 end=last;
Systems_Found = 1;
run;
* now the pdf problems=============================;
options orientation=portrait nodate;
*topmargin=1.5 bottommargin=1
leftmargin=1 rightmargin=1 ;
ODS pdf file="c:\Samppdf1.pdf" ;
ods pdf startpage=no;
title font="Times New Roman" BOLD
color=black
"Number of Crimes Committed by Seriousness of Crime";
run;
proc freq data=TestData ;
where serious in(0 1 2 3);
tables serious /
out=A1(drop=percent rename=(count=Instances));
run;
proc freq data=x1 ;
format serious SevFmt. ;
tables serious / out=B1(drop=percent rename=(count=Occurs));
proc sort data=a1 ;
by serious ;
proc sort data=x1 ;
by serious ;
data both ;
merge a1 b1 ;
by serious ;
run;
ods pdf startpage=now;
run;
ods pdf startpage=never;
title font="Times New Roman" BOLD
color=black
justify=c
"Crime Report for Mid-Sized City";
title2 font="Times New Roman"
color=black
justify=c
"Report for: TestData";
title3 font="Times New Roman"
color=black
justify=c
"Records Reviewed: &&N_Obs1";
title4 font="Times New Roman"
color=black
" ";
title5 font="Times New Roman"
color=black
" ";
run;
proc report data=Both nowd;
column Serious Instances Occurs;
define serious / order=internal left group 'Seriousness Level';
define Instances / group right 'Specific Instances' ;
define Occurs / group right 'Occurs How Often' ;
format instances comma9. occurs comma9.;
run;
goptions reset=all gunit=cm noborder cback=white
ftext='Helvetica/oblique' vsize=5.2 in hsize=4.2 in vorigin=0.2 in
horigin=1.5 in
htitle=0.4 htext=0.4 ctitle=black ctext=black;
*nodisplay;
pattern1 color=cyan; /* Info */
pattern2 color=green; /* Sec Level 1 */
pattern3 color=yellow; /* Sec Level 2 */
pattern4 color=red; /* Sec Level 3 */
legend1 label=(justify=left font="Times/bold" height=0.4 position=top
"Severity Level")
position=(left middle)
offset=(0.1,)
across=1
order=(0 1 2 3)
value=(color=black)
shape=bar(0.3,0.3);
run;
proc gchart data=TestData
;
where Serious in(0 1 2 3) ;
pie Serious /
midpoints=(0 1 2 3)
legend=legend1
value=inside
ctext=black
coutline=black
name="gchart1"
noheading
;
format serious SevFmt. ;
run;
quit;
ODS pdf close ;
;
HTH
Andre
At 22:05 16/02/2003 +0100, you wrote:
>Hi André,
>
>I missed the discussion before this, but have looked with interest at what
>this code does.
>I did't know about the CALL DEFINE ( _ROW_ , "GRSEG" , ... ) syntax. And I
>can't find any proper documentation. Do you have a link?
>
>It opens more possibilities for aligning graphs in your own way, by
>putting them into table cells (although I haven't tested yet whether CALL
>DEFINE ( _COL_ , "GRSEG", .. ) works as well. No need for graph templates
>then.
>
>I write this message also because I think you are using the font
>attributes in the wrong way. When you define text to be used inside graphs
>(TITLE, LEGEND, AXIS, etc.) and to be displayed in system fonts, you have
>to append /bold, /italic, etc., at the fontname, as you do.
>
>But when you define text outside graphs, to be displayed directly by the
>ODS destionation (HTML, RTF, PDF, etc.) then you just you the font name,
>and use the BOLD and ITALIC attributes.
>
>If you look carefully at the titles in the RTF document your code
>produces, you'll see that none of the attributes are honored there. It is
>only by accident that you didn't get errors. Go inside Word into the
>header and look which font is selected. You'll probably see that where you
>specified "Times New Roman/bo" the font "Times" is used. Probably SAS or
>RTF decided that where the full string is not valid, only the first part
>is used.
>
>If you specify a font with a name without spaces, you'll get errors! Try
>"Verdana/bo" e.g.
>The proper syntax is font="Times New Roman" bold 'your title' ;
>
>Greetings,
>
>Frank Poppe
___________
WIELKI Andre
INED - Service Informatique
133 Bd Davout,
75 980 Paris Cedex 20