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: strip factor variable operators?


From   Stas Kolenikov <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: strip factor variable operators?
Date   Tue, 13 Aug 2013 23:12:50 -0500

Thanks, Nick and Jeff.

-- Stas Kolenikov, PhD, PStat (ASA, SSC)
-- Senior Survey Statistician, Abt SRBI
-- Opinions stated in this email are mine only, and do not reflect the
position of my employer
-- http://stas.kolenikov.name



On Tue, Aug 13, 2013 at 10:39 PM, Jeff Pitblado, StataCorp LP
<[email protected]> wrote:
> Stas Kolenikov <[email protected]> asks how to remove all time-series and
> factor variables opterators from a varlist specfication:
>
>> is there a simple way to strip out the time series and factor variable
>> operators? I have a list of regressors with all sorts of stuff like
>> -i.foreign ib3.rep78 c.price##c.price-, and I want to produce a list
>> that is cleaned off the prefixes, just -foreign rep78 price-. Is there
>> a standard parser, or an extended macro function, to do this? I can
>> take the whole list, -gettoken, parse(".")- each term and strip the
>> part before the dot, if there's any. But this seems like a relatively
>> mundane task that must be doable with some official Stata tools.
>
> Nick Cox pointed out that -tsrevar- was a start.
>
> Stas can use the -fvrevar- command to do this.  Here is an example:
>
> ***** BEGIN:
> . sysuse auto
> (1978 Automobile Data)
>
> . fvrevar i.foreign ib3.rep78 c.price##c.price, list
>
> . return list
>
> macros:
>             r(varlist) : "price foreign rep78"
> ***** END:
>
> --Jeff
> [email protected]
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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