Dear All,
consider the following fragment:
According to the documentation, the method Scalar.setString() should save the value to a Stata string scalar, which can be, in particular, r()-value, which is what I need. I see the command doesn't affect the r()-values, though it doesn't result in an error.
Q1: Where is the passed value "test" saved?
Q2: Why is this value is not subsequently retrieved with Scalar.getString() ?
Output:
consider the following fragment:
Code:
clear all
version 18.0
python:
import requests
from sfi import SFIToolkit, Scalar, Macro
def ipinfo1():
SFIToolkit.rclear()
Scalar.setString("r(country)","test") # where does this value go??
Scalar.setValue("r(district)",1)
Macro.setGlobal("r(region)","some region")
print(Scalar.getString("r(country)")) # prints nothing
print("-------- done -------")
end
python: ipinfo1()
scalar list
return list
sreturn list
ereturn list
Q1: Where is the passed value "test" saved?
Q2: Why is this value is not subsequently retrieved with Scalar.getString() ?
Output:
Code:
. python: ipinfo1()
-------- done -------
. scalar list
. return list
scalars:
r(district) = 1
macros:
r(region) : "some region"
. sreturn list
. ereturn list
.
end of do-file
.

Comment