Hi

I have a very basic question. I am working on a loop and inside the loop I want to extract the label attached to a particular value of a variable and store it in a local variable so that I can use it in naming of variables.

Sample Code :

Code:
 
   
clear
set obs 10
gen var = mod(_n, 3) 
 label define lab 0 "India" 1 "Australia" 2 "Myanmar"   
 label values var lab


In the above case, lets say, I want to extract the name of the country if var = = 2

How can that be done in Stata.

Thanks.