Hi,
I am trying to create graphs for 71 countries using a fovalues loop. I want the title of each graph to be equal to the name of the country that it represents. I have tried using a local macro to equal the value of the country_name variable within a given group, but it hasn't worked. Here is my code:
The "local t=..." line here would work if i had one observation per country, but i have varying numbers of observations per country.
I think there is a way to do it using labels, but I haven't found a way to define a label for the variable group without going through one by one.
Thanks in advance for the help.
Best,
Julian
I am trying to create graphs for 71 countries using a fovalues loop. I want the title of each graph to be equal to the name of the country that it represents. I have tried using a local macro to equal the value of the country_name variable within a given group, but it hasn't worked. Here is my code:
Code:
#delimit ; forvalues i=1/71 {; local t= country_name[`i']; graph twoway (scatter nkill v2x_libdem if cgroup==`i') (lfit nkill v2x_libdem if cgroup==`i'), title("`t'") ... graph save lin`i', replace; }; #delimit cr
I think there is a way to do it using labels, but I haven't found a way to define a label for the variable group without going through one by one.
Thanks in advance for the help.
Best,
Julian
Comment