Bookmark and Share

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

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

RE: st: using foreach in regression models - combing graphs from the different variables

From   Tim Evans <>
To   "''" <>
Subject   RE: st: using foreach in regression models - combing graphs from the different variables
Date   Tue, 25 Oct 2011 15:09:33 +0100

Hi all,

I have modified my regression commands in order that I can loop through the variables and graph them. I'm stuck on how to use graph combine to combine these graphs into one page (5 graphs on each page), following on the from the loop as follows:


loc covariates "i.NRCENT i.site__4 sex i.id07 i.yydx"
	foreach var of varlist agegrp id07 NRCENT site__4  {
	di as text "Does `var' affect you getting surgery (any from HES) (Adjusted)"
	cap noi logistic everrcsurgeryhes2 i.`var' `covariates'
		qui do "C:\TEST \labelling" /*
		*/ "O/R of surgery (any from HES) (`var')"
		qui graph export "C:\Test\Adjusted_`var'_surgery (any from HES).png", replace	
		di as text "End of Does `var' affect you getting surgery (any from HES) (Adjusted)"
		graph combine "C:\Test\Unadjusted_`var'_ any surgery from HES.png" ****THIS DID NOT WORK***

I don't know whether I can use regexm to say the filename begins with 'Unadjusted' and ends with 'from HES' and incorporate this into the graph combine, but essentially I don't explicitly name the graphs as they are stored and don't want to name them explicitly (by this I mean type each one out as I may in future add more to my varlist).

I'm assuming I will have to save as .gph before saving the final version as a png if that's my chosen format?

Any ideas greatly appreciated.

Best wishes

This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.

*   For searches and help try:

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