On Wed, 23 Jul 2014, Sven Schreiber wrote:
Am 23.07.2014 14:49, schrieb Allin Cottrell:
> On Wed, 23 Jul 2014, Sven Schreiber wrote:
>
>> obviously it's absolutely essential to be able to create variables only
>> for the currently active subsample. But I'm wondering, is there another
>> (easier) way to generate variables also for the full workfile sample
>> range without temporarily removing and then later re-applying the sample
>> restrictions?
>>
>> Perhaps something like "series mynew = log(income) --full" if you
>> understand what I mean by that.
>
> Yes, understood, but No, there's no such option. The presumption is that
> if you want to define series for the full data range you do so before
> sub-sampling.
>
Right -- what about the $sample accessor. I like the clever way how it
differentiates between non-used and out-of-sample observations after
estimations, but it would also be useful to get a binary dummy series
just for the active sample without any estimates. Of course a workaround
would consist of doing some trivial OLS just to access $sample afterwards...
What I do what I have to fiddle with subsamples a lot is to keep a dummy
variable for that, stay with the full sampl as long as possible and
restrict the sample only when needed, as in
<hansl>
series ACTIVE = (foo > bar) && (year>1995)
ACTIVE = ACTIVE || (moo == 0)
...
smpl ACTIVE --dummy
panel y 0 x1 x2 x3
smpl full
</hansl>
IMO this has a number of advantages. Of course the --balanced option to
the smpl command is a life-saver for panel datasets.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------