Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: AW: tsset on subsample of observations


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: AW: tsset on subsample of observations
Date   Sun, 12 Nov 2006 17:04:23 -0000

I think Tom is right. The short answer is No; 
a longer answer is Yes, by sweeping problematic
observations out of the way. 

First, note the syntax: there is no support for 
-if- and -in- with -tsset-. 

Second, note the logic: -tsset- is for making 
declarations about your dataset. I know you 
want to make declarations about part of your
dataset, but that is not supported. 

I can't see a way of doing what you want 
except by sweeping repeated observations
out of the way, at least temporarily, via 
-drop- or -keep-. 

Nick 
[email protected] 

Robert Duval
 
> Hi Tom,
> 
> Thanks for the suggestion, however it doesn't really get at 
> what I want,...
> 
> After defining tsset, I want to create variables like
> 
> gen z = x-l.x
> 
> and keep this variables in the dataset. For the duplicate obs. z
> should take missing values.
> 
> By using -preserve- / -restore- I lose z after restoring the 
> old dataset.
> 
> Any other suggestion will be greatly appreciated
 
On 11/11/06, Thomas Erdmann <[email protected]> wrote:

> > Couldnt you work with -preserve- and -restore- ?
> >
> > duplicates tag x y, generate(dup)
> > preserve
> > drop if dup~=0
> > tsset x y
> > ...
> > restore
> >
> > Wouldn't it be better to keep one of the duplicate observations?
> > Duplicates drop, force
> > Instead of
> > Drop if dup~=0

Robert Duval

> > Is there a way to tsset a subsample of my observations?
> >
> > I want to perform operations that involve time series 
> commands, but if
> > I consider my entire dataset I have repeated time values within the
> > panel.
> >
> > I would like to Stata to tsset my observations for that 
> subset of obs.
> > that are uniquely identified within each panel... something like:
> >
> > tsset x y if unique==1
> >
> > Is there a way to do this?
> >
> > Otherwise I would be forced to drop the repeated observations, but
> > since I need those obs. for other exercises this will force 
> me to save
> > datasets: one with duplicates and another one without them. 
> Something
> > that seems highly inefficient.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index