I use xtabond2 for 10 different dynamic models, and store each of them. Then to extract the regression results, I use esttab. In esttab, in stats part I type the following==> stats(ar1p ar2p hansenp): ar1p and ar2p are for the p-values of AR(1) and AR(2), hansenp is for the p-value of Hansen test of overidentification restrictions. BUT i don't know what I should type for the p-values of Difference-in-Hansen tests of exogeneity of instruments. I tried "cstatp", but it does not give any result. I would really appreciate your help.

Thanks in advance. ]]>

I need to calculate beta for stocks in the end of each months basing on daily data of the previous 12 months. that is, for example, I take 31st of January and for this date I find beta by taking daily returns of the previous 12 month. So I have 4 columns: date, permno, returns and Mrkt. Am I right that I need "rollreg" to do that?

Another question is how can I get results for the end of each month if I have a daily data. Do I need "apply.monthly"?

I will highly appreciate if somebody could explain me in detail how can I do my task..

Best regards,

Lucy]]>

I use xtabond2 for 10 different dynamic models, and store each of them. Then to extract the regression results, I use esttab. In esttab, in stats part I type the following==> stats(ar1p ar2p hansenp): ar1p and ar2p are for the p-values of AR(1) and AR(2), hansenp is for the p-value of Hansen test of overidentification restrictions. BUT i don't know what I should type for the p-values of Difference-in-Hansen tests of exogeneity of instruments. I tried "cstatp", but it does not give any result. I would really appreciate your help.

Thanks in advance. ]]>

I use xtabond2 for 10 different dynamic models, and store each of them. Then to extract the regression results, I use esttab. In esttab, in stats part I type the following==> stats(ar1p ar2p hansenp): ar1p and ar2p are for the p-values of AR(1) and AR(2), hansenp is for the p-value of Hansen test of overidentification restrictions. BUT i don't know what I should type for the p-values of Difference-in-Hansen tests of exogeneity of instruments. I tried "cstatp", but it does not give any result. I would really appreciate your help.

Thanks in advance. ]]>

I am having an issue with some of my string values.

My dataset has 40 variables that look like this (named DX1, DX2,.. DX40):

491.21

491.21

276.5

394

483.21

.

491.21

883.2

.

324.21

They are strings and I need them to

Can you help me write this code?

I have also never worked with loops before. If you can show how to write code that will make these changes to all 40 variables so I can avoid re-writing commands for each variable?

Thank you!

Michael]]>

I'm trying to do a merge between two datasets that have different characteristics for the same company. One dataset has the company id and the production by product, and the other dataset has the company id and the share of its total operations by city. I want to create a resulting dataset that prorates the production by product to each city according to the city shares. I thought that this would be a good chance to use a m:m merge, but it's giving me bad results. What other approach would you use to deal with this situation?

Thanks,

Jose

]]>

]]>

I hope someone can help me. I want to create a new variable by combining 5 other variables. More specifically: the 5 variables I want to combine all have the values either "TRUE" or "FALSE". Now I would like to create a new variable where I can combine these 5 so that if in any of this 5 variables I have a "TRUE" a "TRUE" will show in the new variable and if I have a "FALSE" in all five variables a "FALSE" will appear in the new variable.

FALSE=1 and TRUE=2. Would it be a possibility to change the FALSE value of 1 into 0 and then count all the ones that end up with a value of 0 and if yes how would this be done?

Does someone, anyone know how to do it in STATA? As I have a very large database to do it all by hand would take very long.

Thank you very much for your help it is much much appreciated.

Isabel]]>

NO STATS, ranges, etc

Don]]>

:

xtfmb var11 var5 var7 var8 var9, verbose est store FMB xtfmb var11 var5 var7 var8 var9, lag(2) est store FMB_Newey reg var11 var5 var7 var8 var9 est store OLS est table *, b se t

]]>

1. char(34)

2. compound quotes

I want to use a local to generate automatic filenames. Date time and a name including a pathname.

the local should give this: "C:/map/map/stata/graph/filename.extension", file name is datatime in a string

goal is that automatic file naming is done with:

graph export "C:/map/map/stata/graph/datetime_graph.tif", as(tif) replace

i have made a datetimelocal and a path local but the command requires the start and end with a double quote.

]]>

I would like to plot a graph with twoway to add a line graph but i would like the xaxis to show year and quarter like in graph bar:

graph bar inflow outflow, over(quarter_num_roman) over(year_num)

To get this I use:

# delimit ;

tsset quarter, quarterly ;

twoway (bar inflow outflow quarter, sort yaxis(2) lwidth(vvthin)) /// ///

|| (line total quarter, sort lpattern(1) lwidth(thin)lcolor("0 45 255") yaxis(1)) , ///

///

yscale(alt axis(1)) ///

yscale(alt axis(2)) ///

ylabel( , tposition(inside) nogrid axis(1) labsize(medsmall)) ///

ylabel( , tposition(inside) axis(2) labsize(medsmall) ) ///

tlabel(2011q4 2012q1(2)2014q4 2014q4, angle(90) tposition(inside) labsize(medsmall) ) ///

ymtick(#4,tlength(tiny) axis(1) ) ///

ymtick(, axis(2) ) ///

tmtick(2011q4(1)2014q4, tlcolor(115 3 14)); ///

///

To get the proper axis I should do something with tmtick but how?

Do-file, and two graphs are attachted

Thanks

Floris

Data

quarter quarter_string inflow outflow total quarter_num quarter_num_roman year_num

2011q4 2011q4 5 0 6 4 IV 2011

2012q1 2012q1 118 0 124 1 I 2012

2012q2 2012q2 6 -2 128 2 II 2012

2012q3 2012q3 4 0 132 3 II 2012

2012q4 2012q4 16 -4 144 4 IV 2012

2013q1 2013q1 53 -6 191 1 I 2013

2013q2 2013q2 27 -8 210 2 II 2013

2013q3 2013q3 18 -15 213 3 II 2013

2013q4 2013q4 25 -26 212 4 IV 2013

2014q1 2014q1 38 -15 235 1 I 2014

2014q2 2014q2 37 -18 254 2 II 2014

2014q3 2014q3 53 -19 288 3 II 2014

2014q4 2014q4 24 -16 296 4 IV 2014]]>

What's wrong with the loop?

bys par: gen votNUM = _N

gen vot = .

foreach elc in elc {

quietly sum votNUM if elc == `elc'

quietly replace vot = (votNUM/r(N)) if elc == `elc'

}

gen vot = .

foreach elc in elc {

quietly sum votNUM if elc == `elc'

quietly replace vot = (votNUM/r(N)) if elc == `elc'

}