Dear all,

I'm trying to put several graphs for several cohorts into cohort-specific html files using dyndoc. The problem I encounter is that while Stata handels the local variables inside the loop correctly, those are expressed literally in the html output instead of with the values that the locals take. I have made a toy-code for the auto data that reflects what I'm doing (much shorter, same issue in output though).

Code:
forval x = 3/5 {
    dyndoc ../../test.txt `x', saving(../Output/test_r`x'.html) nomsg replace
}
where x are cohorts over which I'm looping in my code, but here for the sake of the example the repair records.

Inside test.txt I'm (among other things) generating various graphs. (Those have "fixed" names.) I then want to display these in the file I'm generating with dyndoc.
The code in test.txt is given (in a short version by):

Code:
<<dd_version: 1>>

A Test
=====
<<dd_do: nocom noout>>
sysuse auto, clear
keep if rep == `1'
scatter mpg weight, mcolor(blue%50) name(scatter9, replace)
<</dd_do>>

This is a scatterplot.

<<dd_graph: gr(scatter9) saving(../Output/scatter`1'_9.svg) replace>>
This works fine to the point that "sequenceplot_c3_9.svg" etc. are saved in the corresponding directory. However, in the html files the graphs are referenced as <img src="scatter_c%601'_9.svg"> and hence won't be shown when one looks at the html files.