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

st: program define


From   Frank Zhang <zhangmailer@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: program define
Date   Wed, 25 Aug 2004 15:31:01 -0700 (PDT)

Dear listers, 

I am learning STATA programming. The following
question seems very basic, but I wasted much time
debugging it and failed to get through. 

I copied the following codes exactly from somewhere,
but I can not get it running in STATA 8.1. What's the
problem? 

Thank you very much for your attention. 
_____________________________


set seed 10101
program define simrandm
  version 6.0
  if "`1'"=="?" {
          global S_1 "b_const se_const b_slope
se_usual se_white"
          exit
          }
          drop _all
          set obs 20
          gen x = invnorm(uniform())
          gen u = x*invnorm(uniform())
          gen y = 1+1*x + u
          regress y x, robust
          scalar sewhite=_se[x]
          regress y x
          post `1' (_b[_cons]) (_se[_cons]) (_b[x])
(_se[x]) (sewhite)
end
simul simrandm, reps(1000)



		
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush
*
*   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