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]

st: accessing value labels into a loop

From   "ricardo mora" <>
To   <>
Subject   st: accessing value labels into a loop
Date   Mon, 21 May 2012 12:44:08 -0600

Hello, I am trying to run a program in which I have to use each specific
label of a pair of variables, and all its combinations together.
Lets say I have variables x1 and x2:
x1 value labels are
1 A
2 B
3 C
and x2 value labels are 
1 X
2 Y
3 Z

In an loop I create graphs that should contain both labels combined. This is
the loop that creates de 9 graphs I need:

foreach r of numlist 11 12 13 21 22 23 31 32 33 { 
local z1 = int(r/10)
local z2 = 10*((r/10)-int(r/10))
graph {variables} if var==`r', by(variable) title(label for x1:"A, B or C")
xtitle(label for x2:"X, Y or Z")

This loop creates 9 graphs and the titles and xtitles I expect should be:
1) A X
2) A Y
3) A Z
4) B X
5) B Y
6) B Z
7) C X
8) C Y
9) C Z

My question is: how can I call each of the labels of x1 and x2 into the
graph sintax in the loop?
Thank you very much for your help,
Ricardo Mora

*   For searches and help try:

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