Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use Stata generated variables in PyStata?

    Hi I want to run python codes on the current variables of Stata using PyStata.
    For example:
    • set obs 5
    • gen a = _n
    • python
    • a
    • end
    But python does not recognize "a". Instead I should run:
    • python
    • a = [1, 2, 3, 4, 5]
    • a
    • end
    How can I use the existed "a" instead of new coding?



    Version: 17
    Last edited by Yasin Ahmadi; 13 Dec 2023, 16:10.
Working...
X