Statalist


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

Re: st: quietly noisily ?


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: quietly noisily ?
Date   Tue, 13 May 2008 08:59:34 -0400

I decided to skip the log files and write my SMCL directly
with -file write-. For my purposes this turned out to be a
clear win, as the tables I'm writing are very simple, and got
around all the logging and quietly noisily nesting. The
resulting SMCL is very clean, and translates accurately into
PS.

cheers,
Jeph


Joseph Coveney wrote:
> 
> I'm not sure what your problem is, but it might be that you have a few too
> many quietly-noisily-quietly-noisily recursions in your code. The do-file
> below does the kind of thing that you're trying to do with regard to page
> breaks.  It and its imbedded called program produce output in the log files
> in accordance with when the -noisily- command qualifier is used.  In
> addition, when the called program uses the -in smcl- directive for the page
> break (as in the "yourlog" example), it produces page breaks properly.  (It
> doesn't, of course, when the -_asis- directive is used, as in the "mylog"
> example below.)  The SMCL log files produced aren't broken, either, because
> ultimate Portable Document Format (PDF) files produced are okay, regardless
> of whether printed via PDFCreator from a View window of the SMCL log file
> within Stata or by converting from -translate-'s PostScript file to PDF 
> from
> within GSview.
> 
> Joseph Coveney
> 
> Note that -pagem- isn't doing any keeping track of line counts; it's just
> producing output and SMCL page-break directives.
> 
> clear *
> set more off
> *
> program define pagem
> version 10
> syntax , logfile(string) [Smcl]
> local type = cond("`smcl'" == "", "_asis", "in smcl")
> quietly log on `logfile'
> forvalues page = 1/2 {
>  if `page' == 2 display `type' "{newpage}"
>  forvalues line = 1/10 {
>   display `type' "Called program " _continue
>   display "Page `page' of 2, line `line' of 10"
>  }
> }
> quietly log off `logfile'
> end
> *
> capture log close mylog
> capture log close yourlog
> quietly {
> log using mylog.smcl, smcl name(mylog) replace
> log off mylog
> log using yourlog.smcl, smcl name(yourlog) replace
> log off yourlog
> }
> quietly foreach stuff in here there everywhere {
> log on mylog
> if "`stuff'" != "here" noisily display in smcl "{newpage}"
> noisily display in smcl as text "Do-file loop item: `stuff'"
> log off mylog
> noisily pagem, logfile(mylog)
> log on yourlog
> if "`stuff'" != "here" noisily display in smcl "{newpage}"
> noisily display in smcl as text "Do-file loop item: `stuff'"
> log off yourlog
> noisily pagem, logfile(yourlog) smcl
> }
> quietly {
> log close mylog
> log close yourlog
> }
> translate mylog.smcl mylog.ps, replace
> translate yourlog.smcl yourlog.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