I have an ado called groupfunction which made use of python for calculating Gini coefficients since it is much faster. However, I realized recently that it is not loading the python function. I thought it may be that I made a mistake in my code, but it seems to be a different problem. I'm testing with the example code given in the manual. The python function is not recognized in the program, but it is in memory and can be called on its own, see below:
clear all
version 16.1
python:
from sfi import Data, Scalar
def calcsum(varname, touse):
x = Data.get(varname, None, touse)
Scalar.setValue("r(sum)", sum(x))
end
program varsum
version 16.1
syntax varname [if] [in]
marksample touse
python: calcsum("`varlist'", "`touse'")
display as txt " sum of ‘varlist’: " as res r(sum)
end
sysuse auto, clear
noisily capture varsum price
dis _rc
//But function is in memory!!
gen uno =1
python: calcsum("price", "uno")
dis r(sum)
Any help or thoughts you may have on fixing this would be much appreciated. Thanks!
Related Posts with Ado embedded python code not working
Clustered Errors and fixed effect on the same levelHello Statalist-Forum, I was wondering if you could help me with a problem: I have a continous outc…
xtreg, fe robust: xtoverid error(2b) operator invalid when correcting Hausman test (V_b-V_B is not positive definite) due to year dummiesDear Statalisters, I am analyzing a panel dataset with year dummies over a period of 2000-2018 and …
Division into two groupsDear statalists, I am running an analysis with an unbalanced dataset for 10 years. I would like to …
one year survival - data managementgood day all I have a list of children with 2 variables "date of birth" and "date of death". Both a…
Comparing two waves with RE-LogitI am currently using Panel data from the SOEP to analyze and compare political interest in 2013 and …
Subscribe to:
Post Comments (Atom)
0 Response to Ado embedded python code not working
Post a Comment