Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Complex Stata Code Examples

From   Nick Cox <>
Subject   Re: st: Complex Stata Code Examples
Date   Wed, 22 Jun 2011 08:54:27 +0100

On the contrary, a knowledge of any modern programming language will
have introduced you to many concepts found in Stata, and more
obviously in Mata.

Start with reading [U] thoroughly. Then look at Kit Baum's book


P.S. see also

On Wed, Jun 22, 2011 at 8:41 AM, Mayank Mishra <> wrote:

> Thanks for you inputs. I want to let you know that I started a bit of
> STATA programming which essentially involves very basic coding for
> cleaning the data and a bit of recursions. Frankly speaking, I believe
> my JAVA knowledge is of no use for STATA programming. So, I request
> you to please suggest me as to how should I learn coding in STATA from
> scratch.
> Thanks a lot.
> Mayank
> On Tue, Jun 21, 2011 at 9:29 PM, Stas Kolenikov <> wrote:
>> On Tue, Jun 21, 2011 at 10:37 AM, Mayank Mishra <> wrote:
>>> I need to learn Stata programming proficiently, for an upcoming task.
>>> I am an economist with a little bit of coding experience in JAVA. My
>>> idea of learning programming is to have a problem statement and
>>> learning while solving that problem. So, I request you to please
>>> suggest some source or anything where I can get a little bit complex
>>> problem statement, along with its do file, so that I can check my
>>> progress.
>> From proficient programming viewpoint, your request is poorly formed.
>> There are many dimensions to "Stata programming":
>> 1. Stata data management, as in: merging files, creating new
>> variables, data cleaning, with all sorts of -by- and _n referencing
>> 2. Stata project management, as in: creating labels, chars, checksums, etc
>> 3. Statistical estimation and e-class programs, may be -ml- based or
>> -gmm- based.
>> 4. Matrix manipulations in Mata.
>> 5. Optimization using Mata -optimize()- or -moptimize()-.
>> 6. Class programming in Stata or Mata (this would be dear to your
>> Java-based heart)
>> 7. Software maintenance, with all sorts of -assert-s.
>> 8. Simulations, with all sorts of -post-s.
>> 9. Text file manipulation (e.g., managing SSC archives using Stata,
>> although Java is arguably better suited for that).
>> 10. Development of new graphic tools.
>> 11. C++ plugin development for ultra-speedy computation.
>> ...
>> 99. yada, yada, yada
>> Of course peeking at other folks' code is one of the best ways to
>> learn. Peeking at official Stata code has its pros and cons: there are
>> very efficient Stata tricks scattered in the official code (including
>> many that ensure version compatibility and other aspects of code
>> stability), but there are also undocumented commands and features, as
>> well as internal dependencies that you may need a whole drawing board
>> to figure out. Learning from third-party user's code is easier, as
>> non-Stata Corp programmers tend to rely on official documented Stata,
>> and use more straightforward constructs.
>> One thing you can do is to go back into archives of statalist for
>> about a month, see some requests posted, and try to come up with your
>> own solution. And then look for what Maarten Buis or Nick Cox or Bill
>> Gould or Austin Nichols or Steven Samuels had suggested.
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index