Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Learning how to program Stata


From   Sergio Correia <sergio.correia@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Learning how to program Stata
Date   Wed, 3 Aug 2005 16:29:19 -0500

This order may help you, as it was what I did (actually I'm still learning):

1) At first, don't try to do a -program- .. make do-files with macros...

Eg:
local y wages
local x inflation gdp productivity
regress `y' `x'

Even better, dont do this kind of stuff in do-files.. as you can use
macros interactively.

2) Learn foreach / forvalues.. if you do that, you are mostly gonna
need to use the return commands (ereturn, return, etc.) to be able to
store results in tables, etc.

3) After you feel confortable with 1) and 2), go for programs. Also,
you MUST be VERY familiar with Stata's syntax.

Learn the -program-, -syntax-, -macro-, etc. commands in the
programming guide. At this point, Stata's manuals should be like your
bible.


Some more advice: If you start reading the official ADO files, you may
feel discouraged as they are fairly complex (due to efficiency and its
fool-proof nature). Stuff like `"`var'"' can be quite puzzling at
first. Also, if you want to grasp the basics of programming in a fast
way, try reading some of the manuals that are out there (mostly from
Nicholas Cox and Christopher Baum). For example, this one is quite
good:

http://fmwww.bc.edu/ec-p/wp612.pdf

Sergio

On 8/3/05, Mosi A. Ifatunji <mifatunji@yahoo.com> wrote:
> Thanks Nick,
> 
> I definitely appreciate your concern. In this case, I really do mean
> "program."
> 
> M.
> 
> 
> On 8/3/05 2:50 PM, "Nick Cox" <n.j.cox@durham.ac.uk> wrote:
> 
> > Richard Williams gave some good advice. But he
> > was taking you very literally, that when you
> > say "program" you really do mean "program", i.e.
> > that you will find myself writing -program-
> > files. Until you give examples of what you
> > want, it is not obvious that you do need
> > to learn to program in Stata: it may be
> > that you can do what you want with e.g.
> > do files.
> >
> > Nick
> > n.j.cox@durham.ac.uk
> >
> > Mosi A. Ifatunji
> >>
> >> I am interested in learning how to program formulas in Stata.
> >> Where might I
> >> go or what might I buy to begin learning?
> >
> > *
> > *   For searches and help try:
> > *   http://www.stata.com/support/faqs/res/findit.html
> > *   http://www.stata.com/support/statalist/faq
> > *   http://www.ats.ucla.edu/stat/stata/
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index