Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Christopher Baum <kit.baum@bc.edu> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: scalar and others... |

Date |
Mon, 4 Jun 2012 08:41:34 -0400 |

<> On Jun 4, 2012, at 8:33 AM, Tashi wrote: > I am reading An Introduction to Stata Programming. I came across with this thing and I am not too sure I understood. > > > > 1. the author recommends using built in functions to interpreted codes like egen. Could someone tell me what is an interpreted code and how is it different from built in codes like generate and replace? > > > > 2. I read somewhere(sorry for vaguness) that scalar is global in scope yet the book doesn't mention about it while describing scalar. I guess my question is if scalar is local or global in scope? Items that appear under -help functions- are compiled functions (written in C) which will run faster than similar functions available via -egen-. Recently I translated some code that an inexperienced programmer had written as egen sigma = total(X) rather than using summ sigma, meanonly The latter will produce the sum of the series (r(sum)) much more rapidly, and will not repeat the same value _N times in a variable. The egen total() function is useful under by-control, but should not be used over the whole sample. 2. scalars, like Stata variables, have global scope. Once you define a scalar, it sticks around. That's why in an ado-file (or even in a do-file) where you may be concerned about namespace collisions, you should use -tempname- to create scalars that will then not have the same names as earlier references in the same Stata session. Kit Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html * * 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/

- Prev by Date:
**Re: Re: st: RE: converting graph to pdf** - Next by Date:
**Re: Re: st: RE: converting graph to pdf** - Previous by thread:
**Re: st: scalar and others...** - Next by thread:
**Re: st: Survival Analysis and Seemingly Unrelated Regression** - Index(es):