running syntax on different variables - loop

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

running syntax on different variables - loop

mitja decman
Hi,

I have made a syntax for generating charts. The problem is that I have
to
run this (or any other similar) syntax separately for every variable I
need. So how to do it in the loop.

 

For example:

my-var = array [3]
my-var[1] = q1
my-var[2] = q7all
my-var[3] = q13mult-res

for i = 1 to 3 do begin
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=stratum COUNT()[name=
  "COUNT"] my-var[i] MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
end

Thanks
Mitja

My syntax as example:
* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=stratum COUNT()[name=
  "COUNT"] Q5da MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: stratum=col(source(s), name("stratum"), unit.category())
 DATA: COUNT=col(source(s), name("COUNT"))
 DATA: CCC=col(source(s), name("Q5da"), unit.category())
 GUIDE: axis(dim(1), label("kategorija"))
 GUIDE: axis(dim(2), label("Percent"))
 GUIDE: legend(aesthetic(aesthetic.color.interior), label("Q5da"))
 SCALE: cat(dim(1))
 SCALE: linear(dim(2), include(0))
 SCALE: cat(aesthetic(aesthetic.color.interior))
 ELEMENT: interval.stack(position(summary.percent(stratum*COUNT,
  base.coordinate(dim(1)))),
label(summary.percent( COUNT,base.coordinate(dim(1)) ) ),
  color.interior(CCC), shape.interior(shape.square))
END GPL.