I wish to extract the number of countries in an estimation as a scalar.
I export the results to LaTeX using esttab and I wish to add the number of countries in the results table.
I have prepared a MWE with a sample of the data
MWE:
Code:
clear
input str16 country lbe numscore1
"Slovak Republic" .1609062 .5714904
"Canada" .6978026 -.708186
"Sweden" .4750029 .4303062
"Poland" .7625731 .3039408
"Canada" .6978026 -1.142108
"Russian Federation" .3112665 .4964201
"Estonia" .6068639 .2495946
"Peru" .1787041 1.120539
"United Kingdom" .5715541 1.295992
"Chile" .0202874 2.339742
"United Kingdom" .5715541 .6408792
"Canada" .6978026 .1551091
"New Zealand" .5912121 -.622528
"Canada" .6978026 -.1379412
"Israel" .3363137 1.716994
"Finland" .6105343 .3230855
"Chile" .0202874 -.5432029
"Chile" .0202874 1.095871
"Kazakhstan" .4950767 -.5600912
end
reg numscore1 lbe
estadd scalar AdjuR2 = e(r2_a)
eststo reg1
esttab reg1, stats(N AdjuR2, fmt(%12.0fc 2) labels("N" "Adjusted R-sq"))My aim is to add another row (which will contain the number of countries in the estimation) to the results table.
I use the following code to know how many countries are in the this estimation (13 in this case):
Code:
cap drop flag egen flag = tag(country) tab country if flag
0 Response to Extracting the number of countries in the estimation as a scalar
Post a Comment