Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | annoporci <annoporci@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: generate variable versus define scalar, with conditional statement |
Date | Tue, 15 Jan 2013 22:25:46 +0800 |
See the review
Fantastic reference, thanks Nick.I have read many of your Stata tips and Stata articles, which are very helpful, but hadn't read this particular one.
Thanks a lot, Patrick. --- Patrick Toche. On Tue, 15 Jan 2013 21:59:09 +0800, Nick Cox <njcoxstata@gmail.com> wrote:
See the review in excruciating detail in @article \{dm0055, author = "Cox, N. J.", title = "Speaking Stata: Compared with ...", journal = "Stata Journal", publisher = "Stata Press", address = "College Station, TX", volume = "11", number = "2", year = "2011", pages = "305-314(10)", url = "http://www.stata-journal.com/article.html?article=dm0055"; } Abstract. Many problems in data management center on relating values to values in other observations, either within a dataset as a whole or within groups such as panels. This column reviews some basic Stata techniques helpful for such tasks, including the use of subscripts, summarize, by:, sum(), cond(), and egen. Several techniques exploit the fact that logical expressions yield 1 when true and 0 when false. Dividing by zero to yield missings is revealed as a surprisingly valuable device. http://www.stata-journal.com/article.html?article=dm0055 On Tue, Jan 15, 2013 at 1:52 PM, annoporci <annoporci@gmail.com> wrote:I doubt that you need to loop, but I am completely in the dark over what it is that you want to do. NickI'm generating indices starting at different dates, so I want to use the value of the variable at some date of my choosing (not the firstdate in the dataset!) to generate an index starting at, say, the value 1, by dividing all observations by that value. Very simple. Probably one-lineof code or less. ;-)* * 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/
-- Patrick Toche. * * 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/