Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: smcl question


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: smcl question
Date   Mon, 12 May 2008 12:01:06 -0400

Joseph,

I see I should have provided more information. I open a log
file as smcl, and then use -display- with either nothing or
-in smcl- (I have the same output and problem both ways).

I don't send any other tags, but when I get to where my counter
-$dline- indicates there will be a new page (with $pagelines
rows) before the current table (which is `num' rows) is output,
I do this prior to printing the table:


	if $dline+`num'>$pagelines {
		log on `log1'
		noi di in smcl "{newpage}"
		log off `log1'
		global dline=0
	}


That is, start a newpage and reset the line counter $dline.
The table is output to the log file using -display' (nothing).
What I get is (I'm summarizing hundreds of different
variables, these two are Inches and Feet):

{com}{sf}{ul off}Inches
{col 5}Mean{col 30}     6.5
{col 5}SD  {col 30}     9.2
{col 5}Min{col 30}     0.0
{col 5}Max{col 30}    74.0
{col 5}Obs{col 30}     856
{col 5}Missing{col 30}       0
{smcl}
{com}{sf}{ul off}{smcl}
{com}{sf}{ul off}{newpage}
{smcl}
{com}{sf}{ul off}{smcl}
{com}{sf}{ul off}Feet
{col 5}Mean{col 30}     5.1
{col 5}SD  {col 30}     0.5
{col 5}Min{col 30}     0.0
{col 5}Max{col 30}     6.0
{col 5}Obs{col 30}     840
{col 5}Missing{col 30}      16


When I translate to PostScript and then run Adobe Distiller
or Acrobat (v 8 on XP), I get the page breaking in the right
place (that is, after the Inches table there are a few lines
of white space) but there are two page breaks.

When I open in GhostView I get a message that the page numbers
are not in order, and I can "okay" or "cancel" - if I "okay",
I get just one page (ie, remaining pages lost); if I "cancel"
I get the page breaks just fine.

Does this explain the problem more clearly? Somehow, by inserting
the {newpage} I seem to be screwing up the page numbering, and
different packages (Ghostview, Adobe) treat it differently. But
I can't figure out how to control the page breaks otherwise.

thanks,
Jeph


Joseph Coveney wrote:
Jeph Herrin wrote:

I'm trying to understand why the followin SMCL produces
not one but TWO page breaks, when the postscript translator
is applied:

{smcl}
{com}{sf}{ul off}{smcl}
{com}{sf}{ul off}{newpage}
{smcl}
{com}{sf}{ul off}{smcl}


All I'm doing is writing the {newpage}, but apparently
opening and closing the log file produces the other tags.

--------------------------------------------------------------------------------

Jeff, how are you producing the log file?

With any of the three types of -display- (nothing, -_asis- and -in smcl-) in
either of the two do-files below (logged from a called program or logged
directly from the do-file), the PostScript file produced from the SMCL
directives above only has at most a single page break, i.e., has one or two
pages in total when read by GSview (Version 4.8 on Windows XP Pro, SP3).

Joseph Coveney

Log created from within a called program:

clear *
set more off
program define printem
version 10
syntax , LOGfile(string) [type(string) REPLACE]
capture log close
quietly log using "`logfile'.smcl", smcl `replace'
display `type' "{smcl}"
display `type' "{com}{sf}{ul off}{smcl}"
display `type' "{com}{sf}{ul off}{newpage}"
display `type' "{smcl}"
display `type' "{com}{sf}{ul off}{smcl}"
quietly log close
end
foreach type in nothing _asis "in smcl" {
printem , log("`type'") ///
type(`=cond("`type'" == "nothing", "", "`type'")')
translate "`type'.smcl" "`type'.ps"
}
exit

Log created directly in a do-file:
clear *
set more off
*
capture log close
quietly log using nothing.smcl, smcl replace
display "{smcl}"
display "{com}{sf}{ul off}{smcl}"
display "{com}{sf}{ul off}{newpage}"
display "{smcl}"
display "{com}{sf}{ul off}{smcl}"
quietly log close
translate nothing.smcl nothing.ps, replace
*
quietly log using _asis.smcl, smcl replace
display _asis "{smcl}"
display _asis "{com}{sf}{ul off}{smcl}"
display _asis "{com}{sf}{ul off}{newpage}"
display _asis "{smcl}"
display _asis "{com}{sf}{ul off}{smcl}"
quietly log close
translate _asis.smcl _asis.ps, replace
*
quietly log using "in smcl.smcl", smcl replace
display in smcl "{smcl}"
display in smcl "{com}{sf}{ul off}{smcl}"
display in smcl "{com}{sf}{ul off}{newpage}"
display in smcl "{smcl}"
display in smcl "{com}{sf}{ul off}{smcl}"
quietly log close
translate "in smcl.smcl" "in smcl.ps", replace
exit


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index