Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to put all graphs in a same pdf file?

    Hello.

    I would like to know if it is possible to make Stata combine all pdf generated by the loop below in a single pdf file. I mean each graph combine from the loop becomes a page in the pdf file.

    Here its the Code of the graph combine I want to join in a single pdf file:

    Code:
    foreach pi in  t3m t6m t1y t2y t3y t5y t7y t10y { 
    foreach iv in ed1 ed2 ed3 ed4 ff1 ff2 ff3 ff4 mp1 mp2 mp3 mp4 {
    capture confirm file "$RESULTS/graphs_04/asset_`pi'_`iv'_qe.gph" 
    if _rc == 0 {
    capture confirm file "$RESULTS/graphs_04/asset_`pi'_`iv'_nqe.gph" 
    if _rc == 0 {
    qui: graph combine  "$RESULTS/graphs_04/asset_`pi'_`iv'_nqe.gph"  "$RESULTS/graphs_04/asset_`pi'_`iv'_qe.gph" 
    qui: graph save "$RESULTS/graphs_04/combined/asset_`pi'_`iv'.gph", replace
    qui: graph export "$RESULTS/graphs_04/combined/pdf/asset_`pi'_`iv'.pdf", as(pdf) replace
    
    }
    }
    }
    }
    Thank you for your help!!

  • #2
    Hi Alberto,

    If you have Stata 15, have you tried putpdf command? It works similar to putexcel and you can specify pagebreak option in the loop to get each graph on a new page.

    Comment

    Working...
    X