Hello all:
I have run into an issue in preparing a graph. I am able to graph the data that I want using the code that I have posted below, however, I am having trouble labeling my x-axis. I am graphing the b coefficient for a regression across a series of countries. I would like the country names to be the on the x axis, but I am only able to generate the graph using the country id, as when I try to generate the graph with the country names I receive the following error message: "string variables not allowed in varlist; country is a string variable". Is there a way that I can change the labels from id's to countries in the graph editor after the fact? I would really like to be able to have each country labeled on the x-axis if at all possible. Thank you.
I have run into an issue in preparing a graph. I am able to graph the data that I want using the code that I have posted below, however, I am having trouble labeling my x-axis. I am graphing the b coefficient for a regression across a series of countries. I would like the country names to be the on the x axis, but I am only able to generate the graph using the country id, as when I try to generate the graph with the country names I receive the following error message: "string variables not allowed in varlist; country is a string variable". Is there a way that I can change the labels from id's to countries in the graph editor after the fact? I would really like to be able to have each country labeled on the x-axis if at all possible. Thank you.
Code:
gen significance=p_intinf<0.05 sepscatter b_intinf id if id!=14 & id!=5, separate(significance) msize(3 3),
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str34 country byte id float(b_intinf p_intinf) "Australia" 1 .9716391 .000011603004 "Austria" 2 .4513713 .016493829 "Belgium" 3 .08817817 .0290304 "Canada" 4 .2308944 .012255648 "Chile" 5 20.06056 .5559472 "Denmark" 6 1.3176367 .000404277 "Finland" 7 2.0038514 5.121343e-09 "France" 8 .1371311 .0001762412 "Germany" 9 .02527034 .05414221 "Greece" 10 2.46497 .017690912 "Hungary" 11 .1819101 .8980632 "Ireland" 13 2.392673 .0001423292 "Israel" 14 31.529716 .09694891 "Italy" 15 .2460618 2.3089585e-06 "Japan" 16 .2516834 6.99161e-09 "Mexico" 19 1.24943 .27244684 "Netherlands" 20 .1206307 .020662295 "New Zealand" 21 6.356767 .005591494 "Norway" 22 1.3108352 .000012435406 "Portugal" 24 7.714956 3.1533016e-06 "Spain" 25 .23721674 .0023673815 "Sweden" 26 .50136775 .0015550116 "Turkey" 28 .7287502 .6851235 "United Kingdom" 29 .1651836 .002850089 "United States" 30 .013510913 .01402276 end label var id "Id" label var b_intinf "(mean) b_intinf" label var p_intinf "(mean) p_intinf"
Comment