Bookmark and Share

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]

Re: st: Programming Stata


From   Neil Shephard <n.shephard@sheffield.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Programming Stata
Date   Tue, 16 Aug 2011 14:00:37 +0100

On 16 August 2011 13:41, natasha agarwal <agarwana2@googlemail.com> wrote:
> Dear Statalist,
>
> I am trying to write and run a program in Stata. The program I define
> is as follows and I save it in the do-file
>
> capture program drop fdi
> program fdi, rclass
> local x " lnvfdi mfdi"
> xtprobit expdum 'x', re
> gen double x1b1hat, xb
> gen double scale = normalden(x1bhat1)
> gen double pe1=scale*_b[lnvfdi]
> summarize pe1, meanonly
> return scalar ape1=r(mean)
> drop x1b1hat scale pe1
> end
>
> When I type fdi, I get an error invalid file name.
>
> Can anyone please help me?


If you are going to write it as a program then you should save it as
[filename].ado (not [filename].do as you are implying) and place it in
one of your systems -adopath-'s (to see what these are simply type
-adopath- in Stata.

See [U] 16-18 for greater details on "Do-Files" (Chapter 16)
"Ado-Files (Chapter 17) and "Programming Stata (Chapter 18).

Neil

-- 
"The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data." ~ John Tukey (1986), "Sunset salvo". The American
Statistician 40(1)

Neil Shephard
Clinical Trials Research Unit /
NIHR Research Design Service for Yorkshire & the Humber
University of Sheffield
*
*   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/


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