Statalist


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

Re: st: using vector notation to simplify coding


From   Dan Waldo <[email protected]>
To   [email protected]
Subject   Re: st: using vector notation to simplify coding
Date   Thu, 13 Aug 2009 17:19:43 -0400

Thanks to all who replied to my question -- Marten, Michael and Kit, who 
provided nice solutions, and Nick, who pointed to a helpful FAQ (if I 
haven't listed somebody, it's because my email server sometimes gets a 
little funky). As Kit pointed out, there are several ways to approach 
this problem, ranging from the elegant to the more elegant -- not 
including my original "hit it with a stick"  -- and I am off to the races!

This forum, more than anything else, has shaped my opinion of Stata as 
being user-friendly. Thanks to all for creating a very real sense of 
community .

Dan


Nick Cox wrote:
> This generated a lively and continuing discussion. This is just to point
> out that -search array- points to an FAQ by William Gould. I suspect
> that if he were writing that now he would say less about -while- and
> more about -forvalues-. 
>
> Nick 
> [email protected] 
>
> Dan Waldo
>
> I have data in monthly expenditures in variables ing_1 through ing_6,
> and survey months in variables mes_1 through mes_6 (these vary from
> respondent to respondent). I wish to adjust the monthly expenditures for
> inflation, and I have deflation factors in variables def_1 through
> def_12.
>
> I am pretty accomplished in SAS, but only a novice in Stata. In SAS I
> would say:
>
> array def {12} def_1 - def_12;
> array ing {6} ing_1 - ing_6;
> array mes {6} mes_1 - mes_6;
> do t=1 to 6;
>    month=mes{t};
>    ing{t}=ing{t}/def{month};
>    end;
>
> I have been searching unsuccessfully for the Stata analogue to this; I
> am sure it is written somewhere and I am just not using the best search
> terms.
>
>
> *
> *   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/
>
>   


-- 
Daniel Waldo
Actuarial Research Corporation
5950 Symphony Woods Road, Suite 510
Columbia, Maryland 21044
410.740.9194 ext 19


*
*   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