[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: RE: extract rows from panel dataset
In this case you are giving -inlist- a list a real numbers.
In addition, by using the -numlist- command your program will be able to
accept shorthand conventions for the number lists.
. foo invest mark, t(1/5 8 9) u(1/3 8/10)
The program will pass along the timex list of: 1, 2, 3, 4, 5, 8, 9 and the
units list of: 1, 2, 3, 8, 9, 10
program foo , rclass
syntax varlist(ts min=2 numeric) , Timex(numlist >=0 integer)
local tvar `r(timevar)'
local pvar "`r(panelvar)'"
numlist "`timex'", sort
numlist "`units'", sort
local tx: subinstr local timex " " ",", all
local u: subinstr local units " " ",", all
tempvar foo yx
gen `foo' = 1 if inlist(`tvar',`tx') & inlist(`pvar', `u')
qui mkmat `pvar' `tvar' `varlist' if `foo' == 1, matrix(`yx')
matrix list `yx'
> -----Original Message-----
> From: email@example.com [mailto:owner-
> firstname.lastname@example.org] On Behalf Of Tom Boonen
> Sent: Sunday, September 10, 2006 5:02 PM
> To: email@example.com
> Subject: Re: st: RE: extract rows from panel dataset
> Hi Scott,
> I have one more question: I don't understand why the infile() command
> works here.
> Specifically in your programm the expression:
> `tvar' is a local that contains the timevariable and tx is a list of
> strings that contain the time numbers. In the help file it says that
> infile will only work if all arguments must be reals or all must be
> strings, which does not seem to be the case here.
> Can you please explain. This would be a great help for me to
> understand this potentialy powerfull command better.
* For searches and help try: