Dear Stata Forum members,
I made a program like this:
cap program drop sampletps
program define sampletps
version 14.2
syntax [anything] , p(real .5) N(real) ntps(real) sigma(real .001) ci(real .95)
local z = invnormal((1-`ci')/2)
local sampledpt = (`p'*(1-`p'))/((`sigma'^2/`z'^2)+((`p'*(1-`p'))/`N'))
local dpttps = `N'/`ntps'
local sampletps = `sampledpt'/`dpttps'
di "Samples DPT needed = " `sampledpt'
di "Samples Polling Stations needed = " `sampletps'
end
* test
sampletps, p(.5) N(192000000) ntps(801838) sigma(.001) ci(.99)
however, when I test it, it failed. I got the message like this
invalid syntax
r(197);
can somebody help me what's wrong with this code? Thank you
Best regards,
Afri
Related Posts with failure to run program
multinomial logit questionI am trying to run a multinomial logit as y being the number of credit cards an individual has. I re…
Taking a midpoint of quarterI have two numeric variables labeled quarter (1,2,3,4) and year. I want to generate a new variable t…
Returning the name of a variable that takes on the maximum value within a set of other variables?Hey folks. I have a dataset with respondents reporting how many visits they took to certain recreati…
Accounting for time difference in forecasts when using repeated cross sectional dataI need to forecast repeated cross sectional data (survey data) with (dep. var.) monthly electricity…
Interpreting a fixed effects regression whether the treatment variable is binaryHello all, There have been similar posts about this interpretation but I can't find any with the sa…
Subscribe to:
Post Comments (Atom)
0 Response to failure to run program
Post a Comment