Date: Mon, 29 Nov 2004 05:30:19 -0800
Reply-To: RolandRB <rolandberry@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: RolandRB <rolandberry@HOTMAIL.COM>
Organization: http://groups.google.com
Subject: Re: font size probelm
Content-Type: text/plain; charset=ISO-8859-1
vickey_d@rediffmail.com (vickey) wrote in message news:<c90d16ce.0411280752.233fa838@posting.google.com>...
> hi all
>
> is there any SAS SYSTEM OPTION available, which i can use to set the
> font size. i am using proc report to create a tabular report and there
> are almost 24 columns, and they don't fit on one paze so it prints the
> whole table in 2 pages, i want it to be on 1 page. Can any one know
> how to do it?
>
>
> thank you
> vickey
Change the linesize so it is big enough for the full width of the
report. For example:
options linesize=131;
You will probably want to change the pagesize as well to fit more
lines on a page and you will wonder what value to use. The number of
lines on a page can vary even with a fixed font size as it is possible
to squeeze lines together quite a lot (depends on the font style.
Normal line spacing is 1.2 cell height but with 1.1 it still looks
good and for Courier you can get away with 1.0 as the characters are
not very tall.
If you are on a Unix platform then I have a handy script for
translating paper type, margins, orientation and font sizes into a
linesize and pagesize value. I should have written it as a sas macro
and probably will have to rewrite it. Numeric accuracy with gawk isn't
great hence you will note I have made some slight adjustments. Use it
at your own risk because I don't have huge confidence in it.
#!/bin/bash
# Script : layout2lsps
# Version : 1.0
# Author : Roland Rashleigh-Berry
# Date : 21-Jun-2004
# Purpose : Production script to calculate sas linesize and
pagesize values
# based on paper type, margins and layout.
# SubScripts : toupper
# Notes : All options must be used and given a value. linesize
and pagesize
# are echoed to standard output separated by a space.
# Usage : layout2lsps -l 1.0 -r 1.0 -t 1.0 -b 1.0 -p A4 -f LC12
#================================================================================
# OPTIONS:
#-opt- -------------------------------description--------------------------------
# l (value) left margin (in)
# r (value) right margin (in)
# t (value) top margin (in)
# b (value) bottom margin (in)
# p (value) paper: A4, Letter
# f (value) format (layout)
#================================================================================
# PARAMETERS:
#-pos- -------------------------------description--------------------------------
# 1
#================================================================================
# AMENDMENT HISTORY:
# init --date-- mod-id
----------------------description-------------------------
#
#================================================================================
# Define give-usage-message-then-exit function
usage () {
echo "Usage: layout2lsps -l <left margin (in)> -r <right margin
(in)>" 1>&2
echo " -t <top margin (in)> -b <bottom margin (in)>" 1>&2
echo " -p <paper: A4, Letter> -f <format (layout)> " 1>&2
exit 1
}
# Defaults
valuel= # Default value for left margin
(in)
valuer= # Default value for right margin
(in)
valuet= # Default value for top margin
(in)
valueb= # Default value for bottom margin
(in)
valuep= # Default value for paper
valuef= # Default value for format
(layout)
# Set shell option "extglob" for extended glob pattern matching.
# This is needed to check the layout value supplied.
shopt -s extglob
# "case" statement for action to take on selected options
while getopts "l:r:t:b:p:f:" param ; do
case $param in
"?") # bad option supplied
usage
;;
"l") # (value) left margin (in)
valuel=$OPTARG
;;
"r") # (value) right margin (in)
valuer=$OPTARG
;;
"t") # (value) top margin (in)
valuet=$OPTARG
;;
"b") # (value) bottom margin (in)
valueb=$OPTARG
;;
"p") # (value) paper
# Check that a valid value was entered
OK=0
valuep=$(toupper $OPTARG)
case "$valuep" in
"A4"|"LETTER"|"A4LETTER")
OK=1
;;
esac
if [ $OK -eq 0 ] ; then
echo "Error: Invalid value supplied to option -p" 1>&2
usage
fi
;;
"f") # (value) Format (layout)
# Check that a valid value was entered
OK=0
valuef=$(toupper $OPTARG)
case "$valuef" in #- extended globbing used here
@(L|P)?(C|CT|CW|T|W|TC|WC)@(7|7.5|8|8.5|9|9.5|10|10.5|11|11.5|12))
OK=1
;;
esac
if [ $OK -eq 0 ] ; then
echo "Error: Invalid value supplied to option -f" 1>&2
usage
fi
;;
esac
done
# shift to bring first parameter to position 1
shift $(($OPTIND - 1))
# No parameters allowed
if [ $# -gt 0 ] ; then
echo "Error: (layout2lsps) Do not supply parameters for this script.
Use options only." 1>&2
usage
fi
# Use gawk to calculate linesize and pagesize.
# Echo nothing into it so that we can pass parameter values in.
echo | gawk '
# Use the BEGIN block to fill arrays with height and width inch values
BEGIN {
width["A4P"]=8.2677
height["A4P"]=11.6929
width["A4L"]=11.6929
height["A4L"]=8.2677
width["LETTERP"]=8.5
height["LETTERP"]=11
width["LETTERL"]=11
height["LETTERL"]=8.5
width["A4LETTERP"]=8.2677
height["A4LETTERP"]=11
width["A4LETTERL"]=11
height["A4LETTERL"]=8.2677
}
# ======= main block start here =======
{
# make sure paper and layout are upper case
layout=toupper(layout)
paper=toupper(paper)
# paper form to match array entries is the paper size followed by the
first layout letter
form=paper substr(layout,1,1)
# swap round the margins for landscape mode
if (substr(layout,1,1)=="L")
{
holdm1=lmargin
holdm2=rmargin
lmargin=bmargin
rmargin=tmargin
tmargin=holdm1
bmargin=holdm2
}
# Font width to height ratio is normally 0.6
# but is 0.5 for a "condensed" (i.e. narrow) font.
ratio=0.6
if (index(layout,"C")>0)
ratio=0.5
# If using a tight layout format then line spacing is 1.0 times font
point size.
# If standard then the value 1.1 is used. If wide then the value 1.2
is used.
# Font point size is the number at the end of the layout identifier.
spacing=1.1
if (index(layout,"T")>0) #- tight
spacing=1.0
if (index(layout,"W")>0) #- wide
spacing=1.2
# get font point size by removing letters from the layout
pointsz=layout
gsub(/[LPCTW]/,"",pointsz)
# usable width is the paper width minus left margin minus right margin
usewidth=width[form]-lmargin-rmargin
# maximum characters to fit in usable width
linesize=int((120.450*0.6*usewidth+0.0001)/(pointsz*(ratio+0)))
# usable height is the paper height minus top margin minus bottom
margin
useheight=height[form]-tmargin-bmargin
# maximum lines to fit in usable height
pagesize=int((72.27*useheight+0.0001)/(pointsz*spacing))
# output the results
print linesize, pagesize
}' lmargin="$valuel" rmargin="$valuer" tmargin="$valuet"
bmargin="$valueb" paper="$valuep" layout="$valuef"