Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: using vector notation to simplify coding


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: using vector notation to simplify coding
Date   Wed, 12 Aug 2009 11:18:55 -0400

Dan--
This is really more a data structure issue--you will save yourself a
lot of trouble in the long run by reorganizing the data, for example
by making it "long" format for panel regressions (help reshape). If
you have month and year on the data, you can -merge- to get a cpi
variable and deflate with a line like:
 g realy=y/cpi
and see also -cpigen- on SSC.

On Wed, Aug 12, 2009 at 11:12 AM, Kit Baum<[email protected]> wrote:
> <>
> Dan said
>
> Thanks for the clarification, Kit. I am having trouble shaking the SAS
> mindset on this stuff, and your note, along with Michael's, have helped a
> lot. I "get" the mata approach, being a old Fortran guy ...it feels like a
> cumbersome solution in Stata right now, but I am sure that is a transitory
> feeling.
>
> Actually it is a very elegant solution, taking advantage of the concept of
> 'view matrices' in Stata. Surely as another old Fortran guy you remember the
> EQUIVALENCE statement. That's what is happening with a view matrix (real
> programmers don't need no steenken pointers!) so that changes in Mata to the
> contents of the matrix (Y in my code) actually changes the contents of the
> Stata variables that populate the matrix. That is very powerful (and
> naturally can be dangerous if misunderstood).
>
> See http://ideas.repec.org/p/boc/dsug09/06.html
> (and ITSP, which illustrates this at greater length)
>
> Cheers
> Kit
>
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index