nbstata


Namenbstata JSON
Version 0.8.3 PyPI version JSON
download
home_pagehttps://github.com/hugetim/nbstata
SummaryJupyter kernel for Stata built on pystata
upload_time2025-09-01 23:17:27
maintainerNone
docs_urlNone
authorTim Huegerich
requires_python>=3.9
licenseGNU General Public License v3
keywords nbdev jupyter notebook python stata
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nbstata: a new Stata kernel


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

 

*nbstata* is a [Jupyter
kernel](https://docs.jupyter.org/en/latest/projects/kernels.html) for
[Stata](https://www.stata.com/why-use-stata/) built on top of
[pystata](https://www.stata.com/python/pystata18/index.html).

**[*For the User Guide, click
here.*](https://hugetim.github.io/nbstata/user_guide.html)**

 

## What is Jupyter?

A Jupyter notebook allows you to combine interactive code and results
with [Markdown](https://daringfireball.net/projects/markdown/basics) in
a single document. Though it is named after the three core programming
languages it supports (Julia, Python, and R), it can be used with with a
wide variety of languages.

*nbstata* allows you to create Stata notebooks (as opposed to [using
Stata within a *Python*
notebook](https://www.stata.com/python/pystata18/notebook/Example2.html),
which is needlessly clunky if you are working primarily with Stata).

### Key *nbstata* features

- [x] [Easy
  setup](https://hugetim.github.io/nbstata/user_guide.html#install)
- [x] Works with Stata 17+ (only).
- [x] DataGrid widget with `browse`-like capabilities (e.g., interactive
  filtering)
- [x] Variable and data properties available in a ‘contextual help’ side
  panel
- [x] Quarto [inline
  code](https://quarto.org/docs/computations/inline-code.html) support

Users of Stata 17 or 18.0 also get these features only built-in natively
to Stata 18.5+:

- Displays Stata output without the redundant ‘echo’ of (multi-line)
  commands
- Autocompletion for variables, macros, matrices, and file paths
- Interactive/richtext help files accessible within notebook
- `#delimit ;` interactive support (along with all types of comments)

The video below demonstrates using Stata in a Jupyter notebook. In
addition to the
[NBClassic](https://nbclassic.readthedocs.io/en/stable/notebook.html)
application shown there, *nbstata* can also be used with
[JupyterLab](https://jupyterlab.readthedocs.io/en/stable/getting_started/overview.html),
[VS
Code](https://code.visualstudio.com/docs/datascience/jupyter-notebooks),
or [Quarto](https://quarto.org/).

<img align="center" width="650" src="https://github.com/kylebarron/stata_kernel/raw/master/docs/src/img/jupyter_notebook_example.gif" alt="Animated GIF demoing major Stata kernel features">

### What can you do with Stata notebooks…

…that you can’t do with the [official Stata
interface](https://www.stata.com/features/overview/graphical-user-interface/)?

- Exploratory analysis that is both:
  - interactive
  - preserved for future reference/editing
- Present results in a way that interweaves:[^1]
  - code
  - results (including graphs)
  - rich text:
    1.  lists
    2.  **Headings**
    3.  <img align="left" width="54" height="18.6" src="https://raw.githubusercontent.com/hugetim/nbstata/master/index_files/figure-commonmark/226326ec-1-image-2.png" alt="WordArt of the word 'images'">
    4.  [links](https://hugetim.github.io/nbstata/)
    5.  math: $y_{it}=\beta_0+\varepsilon_{it}$

## Contributing

*nbstata* is being developed using
[nbdev](https://nbdev.fast.ai/blog/posts/2022-07-28-nbdev2/#whats-nbdev).
The `/nbs` directory is where edits to the source code should be made.
(The python code is then exported to the `/nbdev` library folder.)

For more, see
[CONTRIBUTING.md](https://github.com/hugetim/nbstata/blob/master/CONTRIBUTING.md).

## Acknowledgements

Kyle Barron authored the original *stata_kernel*, which works for older
versions of Stata. Vinci Chow created a Stata kernel that instead uses
[pystata](https://www.stata.com/python/pystata18/), which first became
available with Stata 17. *nbstata* was originally derived from his
[*pystata-kernel*](https://github.com/ticoneva/pystata-kernel), but much
of the docs and newer features are derived from *stata_kernel*.

[^1]: Stata [dynamic
    documents](https://www.stata.com/manuals/rptdynamicdocumentsintro.pdf)
    can do this part, though with a less interactive workflow. (See
    also: [markstat](https://grodri.github.io/markstat/),
    [stmd](https://www.ssc.wisc.edu/~hemken/Stataworkshops/stmd/Usage/stmdusage.html),
    and
    [Statamarkdown](https://ssc.wisc.edu/~hemken/Stataworkshops/Statamarkdown/stata-and-r-markdown.html))
    Using *nbstata* with
    [Quarto](https://www.statalist.org/forums/forum/general-stata-discussion/general/1703835-ado-files-and-literate-programming)
    instead gives you a similar workflow, with greater flexibility of
    output.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hugetim/nbstata",
    "name": "nbstata",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "nbdev jupyter notebook python stata",
    "author": "Tim Huegerich",
    "author_email": "hugetim@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6d/78/da815693807db17ad047e38fb75ee0c3f5cde7e95cd54358a027c6128270/nbstata-0.8.3.tar.gz",
    "platform": null,
    "description": "# nbstata: a new Stata kernel\n\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n\u00a0\n\n*nbstata* is a [Jupyter\nkernel](https://docs.jupyter.org/en/latest/projects/kernels.html) for\n[Stata](https://www.stata.com/why-use-stata/) built on top of\n[pystata](https://www.stata.com/python/pystata18/index.html).\n\n**[*For the User Guide, click\nhere.*](https://hugetim.github.io/nbstata/user_guide.html)**\n\n\u00a0\n\n## What is Jupyter?\n\nA Jupyter notebook allows you to combine interactive code and results\nwith [Markdown](https://daringfireball.net/projects/markdown/basics) in\na single document. Though it is named after the three core programming\nlanguages it supports (Julia, Python, and R), it can be used with with a\nwide variety of languages.\n\n*nbstata* allows you to create Stata notebooks (as opposed to [using\nStata within a *Python*\nnotebook](https://www.stata.com/python/pystata18/notebook/Example2.html),\nwhich is needlessly clunky if you are working primarily with Stata).\n\n### Key *nbstata* features\n\n- [x] [Easy\n  setup](https://hugetim.github.io/nbstata/user_guide.html#install)\n- [x] Works with Stata 17+ (only).\n- [x] DataGrid widget with `browse`-like capabilities (e.g., interactive\n  filtering)\n- [x] Variable and data properties available in a \u2018contextual help\u2019 side\n  panel\n- [x] Quarto [inline\n  code](https://quarto.org/docs/computations/inline-code.html) support\n\nUsers of Stata 17 or 18.0 also get these features only built-in natively\nto Stata 18.5+:\n\n- Displays Stata output without the redundant \u2018echo\u2019 of (multi-line)\n  commands\n- Autocompletion for variables, macros, matrices, and file paths\n- Interactive/richtext help files accessible within notebook\n- `#delimit ;` interactive support (along with all types of comments)\n\nThe video below demonstrates using Stata in a Jupyter notebook. In\naddition to the\n[NBClassic](https://nbclassic.readthedocs.io/en/stable/notebook.html)\napplication shown there, *nbstata* can also be used with\n[JupyterLab](https://jupyterlab.readthedocs.io/en/stable/getting_started/overview.html),\n[VS\nCode](https://code.visualstudio.com/docs/datascience/jupyter-notebooks),\nor [Quarto](https://quarto.org/).\n\n<img align=\"center\" width=\"650\" src=\"https://github.com/kylebarron/stata_kernel/raw/master/docs/src/img/jupyter_notebook_example.gif\" alt=\"Animated GIF demoing major Stata kernel features\">\n\n### What can you do with Stata notebooks\u2026\n\n\u2026that you can\u2019t do with the [official Stata\ninterface](https://www.stata.com/features/overview/graphical-user-interface/)?\n\n- Exploratory analysis that is both:\n  - interactive\n  - preserved for future reference/editing\n- Present results in a way that interweaves:[^1]\n  - code\n  - results (including graphs)\n  - rich text:\n    1.  lists\n    2.  **Headings**\n    3.  <img align=\"left\" width=\"54\" height=\"18.6\" src=\"https://raw.githubusercontent.com/hugetim/nbstata/master/index_files/figure-commonmark/226326ec-1-image-2.png\" alt=\"WordArt of the word 'images'\">\n    4.  [links](https://hugetim.github.io/nbstata/)\n    5.  math: $y_{it}=\\beta_0+\\varepsilon_{it}$\n\n## Contributing\n\n*nbstata* is being developed using\n[nbdev](https://nbdev.fast.ai/blog/posts/2022-07-28-nbdev2/#whats-nbdev).\nThe `/nbs` directory is where edits to the source code should be made.\n(The python code is then exported to the `/nbdev` library folder.)\n\nFor more, see\n[CONTRIBUTING.md](https://github.com/hugetim/nbstata/blob/master/CONTRIBUTING.md).\n\n## Acknowledgements\n\nKyle Barron authored the original *stata_kernel*, which works for older\nversions of Stata. Vinci Chow created a Stata kernel that instead uses\n[pystata](https://www.stata.com/python/pystata18/), which first became\navailable with Stata 17. *nbstata* was originally derived from his\n[*pystata-kernel*](https://github.com/ticoneva/pystata-kernel), but much\nof the docs and newer features are derived from *stata_kernel*.\n\n[^1]: Stata [dynamic\n    documents](https://www.stata.com/manuals/rptdynamicdocumentsintro.pdf)\n    can do this part, though with a less interactive workflow. (See\n    also: [markstat](https://grodri.github.io/markstat/),\n    [stmd](https://www.ssc.wisc.edu/~hemken/Stataworkshops/stmd/Usage/stmdusage.html),\n    and\n    [Statamarkdown](https://ssc.wisc.edu/~hemken/Stataworkshops/Statamarkdown/stata-and-r-markdown.html))\n    Using *nbstata* with\n    [Quarto](https://www.statalist.org/forums/forum/general-stata-discussion/general/1703835-ado-files-and-literate-programming)\n    instead gives you a similar workflow, with greater flexibility of\n    output.\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3",
    "summary": "Jupyter kernel for Stata built on pystata",
    "version": "0.8.3",
    "project_urls": {
        "Homepage": "https://github.com/hugetim/nbstata"
    },
    "split_keywords": [
        "nbdev",
        "jupyter",
        "notebook",
        "python",
        "stata"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8403a53ed9e1396cd1e5a3f759148495494d1dbc50891e8b05832b6d9cf6accf",
                "md5": "88b95d5f1401cab25ab5590913cbd954",
                "sha256": "a994f625be278e5195f806c66cc17ce63d11d24d558e5885688b044a9ee07dc3"
            },
            "downloads": -1,
            "filename": "nbstata-0.8.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "88b95d5f1401cab25ab5590913cbd954",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 186104,
            "upload_time": "2025-09-01T23:17:26",
            "upload_time_iso_8601": "2025-09-01T23:17:26.261769Z",
            "url": "https://files.pythonhosted.org/packages/84/03/a53ed9e1396cd1e5a3f759148495494d1dbc50891e8b05832b6d9cf6accf/nbstata-0.8.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6d78da815693807db17ad047e38fb75ee0c3f5cde7e95cd54358a027c6128270",
                "md5": "f50f512b3527236c70c9ce2c954af41f",
                "sha256": "23e196febcad00d8144af15d69a1c1b93f0a3edfba7a42a8430a36aaa4393c32"
            },
            "downloads": -1,
            "filename": "nbstata-0.8.3.tar.gz",
            "has_sig": false,
            "md5_digest": "f50f512b3527236c70c9ce2c954af41f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 153120,
            "upload_time": "2025-09-01T23:17:27",
            "upload_time_iso_8601": "2025-09-01T23:17:27.589939Z",
            "url": "https://files.pythonhosted.org/packages/6d/78/da815693807db17ad047e38fb75ee0c3f5cde7e95cd54358a027c6128270/nbstata-0.8.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-01 23:17:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hugetim",
    "github_project": "nbstata",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nbstata"
}
        
Elapsed time: 3.37762s