Bookmark and Share

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: mata's st_data


From   Tirthankar Chakravarty <[email protected]>
To   [email protected]
Subject   Re: st: mata's st_data
Date   Fri, 10 Sep 2010 06:59:41 -0700

Use -st_macroexpand()-:
*******************************************
clear*
set obs 10
foreach x of newlist a b c d {
	g var_`x' = runiform()
}
li
mata
st_data(.,st_macroexpand("var_*"),.)
end
*******************************************

T

On Fri, Sep 10, 2010 at 6:47 AM, joe j <[email protected]> wrote:
> I was wondering if there is a way to use wildcard for variable names
> in mata's "st_data" function. I have a large number of variables, like
> US_ctry, UK_ctry, etc, all of which could be defined in Stata as
> "*ctry".
>
> But when I try the following in mata:
> A  =  st_data(.,(“*ctry”)).
>
> I get the warning:
>
> *ctry invalid name
>
> The (tedious) alternative is: A  =  st_data(.,(“US_ctry”, “UK_ctry")
>
> Any suggestion would be appreciated, because the number of variables
> are too many.
>
> Joe
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index