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

Re: st: Error from 'post' command


From   Sidney Atwood <satwood@hsph.harvard.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Error from 'post' command
Date   Sat, 2 Nov 2002 07:42:22 -0500 (EST)

I've made this mistake a million times. My original training was in BASIC not C.
Case CoUnTs! Undeclared names are illegal. You need to match the declared names with your posted names.

		global S_1 "sigmaCK sigmaCL sigmaKL"

	post `1' (sigma_ck) (sigma_cl) (sigma_kl)

#################################################

Sidney Atwood                       Kresge, LL-17
Manager                     677 Huntington Avenue
                            Boston, MA 02115-6096
Instructional Computing Facility
School of Public Health         PH - 617.432.3134
Harvard University             FAX - 617.432.4998

#################################################


Date: Fri, 1 Nov 2002 15:45:40 -0800 
From: "Nevo, Dorit" <dorit.nevo@commerce.ubc.ca>
Subject: st: Error from 'post' command

When I'm running the program below I get the following error "( invalid
name"
I know that something's wrong with the post command because when I don't
include it the program runs OK.

Can anybody help?

Dorit


*************************************

program define test
	version 7.0
	if "`1'" == "?" {
		global S_1 "sigmaCK sigmaCL sigmaKL"
		exit
	}
	nl ces lnva93
	scalar B0 = _b[B0]
	scalar R = _b[R]
	scalar Dc = _b[Dc]
	scalar Dk = _b[Dk]
	scalar Bcc = _b[Bcc]
	scalar Bkk = _b[Bkk]
	scalar Bll = _b[Bll]
	scalar Bck = _b[Bck]
	scalar Bcl = _b[Bcl]
	scalar Bkl = _b[Bkl]
  	scalar C = 14.86249
	scalar lnC = 2.69884
	scalar K = 576.6429
	scalar lnK = 6.357223
	scalar L = 486.6226
	scalar lnL = 6.187489
	scalar Z = Dc*C^(-R)+Dk*K^(-R)+(1-Dc-Dk)*L^(-R)
	scalar V =	exp(B0 - (1/R)*ln(Dc*(C^(-R)) + Dk*(K^(-R)) +
(1-Dc-Dk)*(L^(-R))) + Bcc*(lnC^2) + Bkk*(lnK^2) + Bll*(lnL^2) + Bck*lnC*lnK
+ Bcl*lnC*lnL + Bkl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l = (0,Fc,Fk\Fc,Fcc,Fck\Fl,Fcl,Fkl)
	scalar DHkl = - det(Hkl)
	scalar sigma_kl =  ((C*Fc+K*Fk+L*Fl)/(K*L))*(DHkl/DH)
	
	post `1' (sigma_ck) (sigma_cl) (sigma_kl)

end

*******************************************************


Dorit Nevo
PhD Candidate, MIS
Faculty of Commerce, University of British Columbia
http://people.commerce.ubc.ca/phd/dnevo
(604) 822-4772

*
*   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