Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Joerg Luedicke <joerg.luedicke@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Importing a variable from another STATA file and an "xtregar" question |

Date |
Tue, 7 Jun 2011 11:18:56 -0400 |

On Tue, Jun 7, 2011 at 10:45 AM, Jason Hecht <jhecht58@gmail.com> wrote: > Any help with the following questions would be greatly appreciated: > > 1. I created a smaller panel STATA datafile from a larger panel > datafile by discarding unneeded variables. I now want to bring in a > single variable from the larger datafile into the smaller panel > datafile. Is there an easy way to do this. > At the point you are, you probably need to merge it back in (see -help merge-). Better would have been if you had written the code that produces your reduced data set as part of your do-file. In that case, you could simply go back to that section in your do-file, add the variable name, and run the do-file again. > > 2. I am running the following model: > > xtregar capexppenet salesppenet if totalassets>1000, re rhotype(theil) twostep > > However, instead of using "totalassets>1000," I now want to run the > model on the upper 5% of the distribution of total assets. > > Is there an easy way to do this in the above model estimation code? > One possibility would be to summarize "totalassets" and then either put in the saved results directly: sum totalassets, d xtregar capexppenet salesppenet if totalassets> r(p95), re rhotype(theil) twostep or you could save the summarize result in a scalar, for example: sum totalassets, d scalar assets_p95=r(p95) xtregar capexppenet salesppenet if totalassets>assets_p95, re rhotype(theil) twostep which would be useful if you want to use it again with other stuff being done in-between. (All of that is assuming there are no missing values in "totalassets". If there are MVs, just take that into account, too)) J. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Importing a variable from another STATA file and an "xtregar" question***From:*Jason Hecht <jhecht58@gmail.com>

- Prev by Date:
**Re: st: Importing a variable from another STATA file and an "xtregar" question** - Next by Date:
**RE: st: AW: RE: Error ivreg2 "must have ranktest version 01.2.02 or geater..."** - Previous by thread:
**Re: st: Importing a variable from another STATA file and an "xtregar" question** - Index(es):