Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: extract
Nick Cox <firstname.lastname@example.org>
Re: st: extract
Sat, 19 May 2012 07:12:00 +0100
Note that -if- and -in- are not considered to be options. They are
su X if nvar == 5 & tvar == 1995, meanonly
local value `r(min)'
As the -summarize- should select precise one observation, various
other saved results would work equally well.
Nicholas J. Cox. 2011. Speaking Stata: Compared with ...
Stata Journal 11(2): 305-314
Abstract. Many problems in data management center on relating values
to values in other observations, either within a dataset as a whole or
within groups such as panels. This column reviews some basic Stata
techniques helpful for such tasks, including the use of subscripts,
summarize, by:, sum(), cond(), and egen. Several techniques exploit
the fact that logical expressions yield 1 when true and 0 when false.
Dividing by zero to yield missings is revealed as a surprisingly
On Sat, May 19, 2012 at 3:46 AM, Paulo Regis
> I am struggling to extract the value of a variable from a panel.
> I have a panel where "tvar" is time (eg: 1971-2010, that is data for
> 40 years ) and "nvar" is the id of each panel (eg: 1,2,... 10, that is
> data for 10 individuals). My variable of interest is X. I would like
> to extract the value of X for individual 5 in 1995 and save it in a
> local. I have tried to use the option "if" but did not work with
> "local" but did nto work. So far, I managed to use the option "in"
> with the command "local" but then I have to find the location of X in
> 1995 for individual 5 by hand.
* For searches and help try: