Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72771

Trying to loop graph export

$
0
0
I'm using Stata/MP 13.0 , and I'm trying to export several graphics from a longitudinal based data( 69 variables and 26 cross-section units) , So far I tried two different approaches
First, I tried to loop over the cross-sectional units:
:
cd "$graphfolder"
levelsof city
foreach a in r(levels){
xtline y1 if id==`a' , title(`a')
graph export "$graphfolder\y1-demeaned.png" , as(png) replace
}
I got "type mismatch" error , r(109)

And tried to loop over variables:
:
cd "$graphfolder"
forval num = 1/69 {
xtline y`num' if id==1 , title("city id==1")
graph export "$graphfolder\y`num' -demeaned.png" , as(png) replace
}
And the problem is, I think, with the first onde is that title() does not "accept" the loop. And the second one is the same thing except with the file name.
How do I overcome this problem? Should I write for each graphic ? Because the 'overlay' option is almost impossible to understand the graphic with so many cross-section units.
Thanks

Viewing all articles
Browse latest Browse all 72771

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>