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]
Fri, 2 Jul 2010 21:55:25 +0200
the original data I'm working with has a panel structure but as a robustness
test, I now would like to run an OLS regression on average values.
Therefore, I used mean values to build a cross section of the independent
variables and defined the dependent variable to be the sum of its values
over the whole observation period.
In order to tell Stata to use only one observation per country I originally
added an If-condition that restricted the sample to include only the latest
observation available in the dataset
regress ln_sum_y ln_mean_x1 ln_mean_x2 mean_x3 ln_mean_x4 if year
But the problem is that for some countries there are no observations for
2008, but only for earlier years. So I need to tell Stata to use the latest
observation that is available for a certain country. As easy as it may sound
I could not come up with an idea of how to define the If-condition in the
I would be really grateful if anybody of you could come up with an idea.
* For searches and help try: