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

st: RE: learning macros

From   "Nick Cox" <>
To   <>
Subject   st: RE: learning macros
Date   Fri, 13 Jun 2003 11:12:32 +0100

Ada Ma
> I am thinking about learning how to write macros (purely 
> becoz it sounds
> like fun and I just want to learn it for the sake of it).  
> Please advice on
> me where to start and whether there are any (hopefully free) online
> materials that I can use to learn the ropes?

By macros I think you mean Stata programs. 
Here is one take. 

1. Almost all of what you need is in the manuals 
somewhere, but not necessarily in the right order. 
The relevant chapters in [U] are the best start. 
[P] is vastly informative but a reference manual, 
not a text. 

2. The Stata NetCourses are excellent. 

3. It is often best to learn from 
examples. Stata's own ado files 
are, in a sense, the best single resource
for the budding programmer. 

4. Some books on Stata include a 
chapter on programming, but most 
texts I know concentrate overwhelmingly 
on interactive use. 

5. The best way for you in detail 
will depend a little on your previous 
programming experience, if any. Some 
treatments will be a little difficult 
without _any_ programming experience, 
but on the other hand saturation 
in some other languages might be 
a disadvantage. That's a relatively small 
point, however. 

6. A certain column led by a certain 
person in the Stata Journal doesn't 
talk about programming in the strict 
sense, but it does discuss in some 
detail Stata constructs like -by:-, 
-foreach-, -forvalues-, etc., which 
are key to much Stata programming. 

7. Various specialised books 
such as that on -ml- will be indispensable 
for many tasks. 

8. Use a decent text editor. It's 
incidental, in a sense, but it makes 
Stata programming and much else 
a lot less painful. You can read 
the collective recommendations of 
some 25 Stata experts at

P.S. I get no commission on any of the 
products or services mentioned here. 


*   For searches and help try:

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