Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: export graphs to pdfs with option to append pages?


From   "MacLennan, Graeme" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: RE: export graphs to pdfs with option to append pages?
Date   Fri, 24 Jan 2014 10:37:14 +0000

To add to David's comments, you can do this using Stata/latex combo easily.  Baby example providing a histogram per page (you can make this a sophisticated as you like)

*** begin ***

set more off
foreach q of varlist q* {
histogram `q'
graph export `q'h.pdf, replace
}

file open myfile using "Histo.txt", write replace
foreach q of varlist q* {
file write myfile "\begin{figure}[h!]"  _n ///
"\caption{""`q'""}"  _n ///
"\centering"  _n  ///
"\includegraphics{""`q'""h.pdf}" _n ///
"\end{figure}" _n  ///
"\clearpage"  _n
}
file close myfile
set more on

*** end ***

You then just need to \insert the Histo.txt file into your tex file, which of course can write and compile directly from Stata also.
HTH

Graeme MacLennan


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Radwin, David
Sent: 23 January 2014 22:37
To: [email protected]
Subject: st: RE: export graphs to pdfs with option to append pages?

I can't think of how to do this directly in Stata, but you could use another program to merge single-page PDFs.

Ghostscript, for example, is an open source program for various platforms, and I believe you could run it as a command line from a Stata -shell- (in Unix or Mac, at least).

http://www.ehow.com/how_6874571_merge-pdf-files-ghostscript.html
http://ghostscript.com/Ghostscript.html

David
--
David Radwin, Senior Research Associate
Education and Workforce Development
RTI International
2150 Shattuck Ave. Suite 800, Berkeley, CA 94704
Phone: 510-665-8274

www.rti.org/education


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Sui Zhang
> Sent: Wednesday, January 22, 2014 8:19 PM
> To: [email protected]
> Subject: st: export graphs to pdfs with option to append pages?
>
> Dear All,
>
> I need to generate a large amount of graphical reports routinely.
> Right now, I need to combine pages in Acrobat after exporting graphs
> to single- page pdfs. I wonder if there's an easier way to generate
> multi-page pdfs directly in Stata.
>
> Thank you so much
>
>
>
> --
> Sui Zhang
>
> Research Data Analyst
> Mental Health Services and Policy Program Feinberg School of Medicine
> Northwestern University
> Tel: 312-503-1130


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
The University of Aberdeen is a charity registered in Scotland, No SC013683.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index