Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Storing of Confidence Level and Standard Error estimates in Stata


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Storing of Confidence Level and Standard Error estimates in Stata
Date   Tue, 5 Aug 2008 18:21:27 +0100

Your program won't work if only because you have declared -syntax
varname- and then expect it to handle a varlist with two variables. 

The next bug is that you have not defined locals r1, r2, so your
r(varname) will presumably contain just a comma. 

It's always a good idea to include a -version- statement. 

That said, I am not clear why you get the error message you do.

program define myprog, rclass
	version 8.2 
	syntax varlist(min=2 max=2) 
	return local varlist `varlist'

might be a better start. 

Nick
[email protected] 

arka roy

Thanks so much for the quick response.Now I have run into a new
problem.I have svyset the data.For each district in a state I am
actually trying to estimate ratios of a no of variables and the
corresponding standard errors,no of observations and the design effect
and get them into a matrix form so that copy pasting it into an EXCEL
worksheet is easier.Here s the program I wrote(this is for a state
which has 37 districts):

program define myprog,rclass
syntax varname
return local varname `r1',`r2'
matrix define T=J(37,4,0)
forvalues i=1(1)37{
use "C:\Documents and Settings\Xp\Desktop\data files\state1.dta",clear
keep if district==`i'
svy:ratio `r1' `r2'
matrix define A`i'=e(b)
matrix define B`i'=e(N)
matrix define C`i'=e(V)
estat effects,deff
matrix define D`i'=r(deff)
matrix define Z`i'=A`i',B`i',C`i',D`i'
matrix T[`i',1]=Z`i'
}
end
myprog var1 var2
Typing myprog var1 var2 yields the following error message in Stata:
unrecognized command: var1 var2
I can not figure out what is wrong.Can I not use e( ) and r( ) in the
same program?

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index