Hi, I would like to run the following commands:
over id which is an encoded identifier of countries. Also if it is possible I would like to save all test statistics and if it can be done also all selected years from sbreak into new dataset which would have three columns: c1 id, c2 wald test statistics from sbreak and c3 selected break year from sbreak.
Below is the example of my dataset:
I tried to create the first part of my request by the following loop:
But I am getting invalid syntax.
Thanks for any help in advance.
Code:
regress gypci, robust estat sbreak
Below is the example of my dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long id double gypci int year 1 .09156394379937814 1995 1 -.1946548261513857 1996 1 .45043848042028495 1997 1 -.06380285276712752 1998 1 -.18338492534911402 1999 1 .11603080672480595 2000 1 -.5918871227579264 2001 1 .21945248334668577 2002 1 .09863957820774673 2003 1 .4457930628629913 2004 1 -.20626793628824608 2005 1 .24845927625451938 2006 1 -.022434578997770308 2007 1 -.6777062107409749 2008 1 -1.1262354856201757 2009 1 .9548509824936363 2010 1 -.12776224134650863 2011 1 -.430161120751026 2012 1 .09153558707071675 2013 1 .025060175267392643 2014 1 .020079096725331275 2015 1 .004253382006176759 2016 1 .0589749711884323 2017 1 -.08630903937951132 2018 2 .09156394379937814 1995 2 -.1946548261513857 1996 2 .45043848042028495 1997 2 -.06380285276712752 1998 2 -.18338492534911402 1999 2 .11603080672480595 2000 2 -.5918871227579264 2001 2 .21945248334668577 2002 2 .09863957820774673 2003 2 .4457930628629913 2004 2 -.20626793628824608 2005 2 .24845927625451938 2006 2 -.022434578997770308 2007 2 -.6777062107409749 2008 2 -1.1262354856201757 2009 2 .9548509824936363 2010 2 -.12776224134650863 2011 2 -.430161120751026 2012 2 .09153558707071675 2013 2 .025060175267392643 2014 2 .020079096725331275 2015 2 .004253382006176759 2016 2 .0589749711884323 2017 2 -.08630903937951132 2018 3 .09156394379937814 1995 3 -.1946548261513857 1996 3 .45043848042028495 1997 3 -.06380285276712752 1998 3 -.18338492534911402 1999 3 .11603080672480595 2000 3 -.5918871227579264 2001 3 .21945248334668577 2002 3 .09863957820774673 2003 3 .4457930628629913 2004 3 -.20626793628824608 2005 3 .24845927625451938 2006 3 -.022434578997770308 2007 3 -.6777062107409749 2008 3 -1.1262354856201757 2009 3 .9548509824936363 2010 3 -.12776224134650863 2011 3 -.430161120751026 2012 3 .09153558707071675 2013 3 .025060175267392643 2014 3 .020079096725331275 2015 3 .004253382006176759 2016 3 .0589749711884323 2017 3 -.08630903937951132 2018 4 .09156394379937814 1995 4 -.1946548261513857 1996 4 .45043848042028495 1997 4 -.06380285276712752 1998 4 -.18338492534911402 1999 4 .11603080672480595 2000 4 -.5918871227579264 2001 4 .21945248334668577 2002 4 .09863957820774673 2003 4 .4457930628629913 2004 4 -.20626793628824608 2005 4 .24845927625451938 2006 4 -.022434578997770308 2007 4 -.6777062107409749 2008 4 -1.1262354856201757 2009 4 .9548509824936363 2010 4 -.12776224134650863 2011 4 -.430161120751026 2012 4 .09153558707071675 2013 4 .025060175267392643 2014 4 .020079096725331275 2015 4 .004253382006176759 2016 4 .0589749711884323 2017 4 -.08630903937951132 2018 5 .09156394379937814 1995 5 -.1946548261513857 1996 5 .45043848042028495 1997 5 -.06380285276712752 1998 end label values id id label def id 1 "Afghanistan", modify label def id 2 "Albania", modify label def id 3 "Algeria", modify label def id 4 "American Samoa", modify label def id 5 "Andorra", modify
Code:
for i in 1/197 { regress gypci if id = `i', robust estat sbsingle }
Thanks for any help in advance.
Comment