saspy | Python interface module to the SAS System | Code Editor library

 by   sassoftware Python Version: 5.14.0 License: Non-SPDX

kandi X-RAY | saspy Summary

kandi X-RAY | saspy Summary

saspy is a Python library typically used in Editor, Code Editor applications. saspy has no bugs, it has no vulnerabilities, it has build file available and it has high support. However saspy has a Non-SPDX License. You can install using 'pip install saspy' or download it from GitHub, PyPI.

This module provides interfaces between Python and SAS. This module enables a Python developer to create mixed Python/SAS workflows to leverage the powers of both SAS and Python, by connecting a Python process to any of a variety of SAS deployments, where it will run SAS code. The SAS code is generated by the SASPy object and methods or explicitly user written. Results from SAS are returned as text, HTML5 documents (via SAS ODS), or as Pandas Data Frames. This module supports running analytics and returning the resulting graphics and result data to the Python process. It can convert data representations between SAS Data Sets and Pandas Data Frames. This module has multiple access methods which allow it to connect to local or remote Linux SAS, IOM SAS on Windows, Linux (Including Grid Manager), or MVS, and local PC SAS. It can run within various Notebooks platforms, or IDE's/UI's or in interactive line mode Python or in Python batch scripts. It is expected that the user community can, and will, contribute enhancements.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              saspy has a highly active ecosystem.
              It has 332 star(s) with 141 fork(s). There are 47 watchers for this library.
              There were 1 major release(s) in the last 6 months.
              There are 0 open issues and 379 have been closed. On average issues are closed in 7 days. There are no pull requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of saspy is 5.14.0

            kandi-Quality Quality

              saspy has 0 bugs and 0 code smells.

            kandi-Security Security

              saspy has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              saspy code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              saspy has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              saspy releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed saspy and discovered the below as its top functions. This is intended to give you an instant insight into saspy implemented functionality, and help decide if they suit your requirements.
            • Convert pandas dataframe to sasdata
            • Convert Pandas DataFrame to SASdata
            • Convert a Pandas DataFrame to a SASdata object
            • Appends data to the SASdata object
            • Start the socket
            • Return a Pandas DataFrame
            • Return information about the results
            • Check for errors in log
            • Process interupt
            • Return a list of directories for a directory
            • Lists all available tables
            • Convert a set of Docs to Markdown documentation
            • Check if the given libref exists
            • Convert SAS data to DataFrame
            • Submit code to LST
            • Write a Pandas DataFrame to a SAS Data Table
            • Initialize the session
            • Upload file to remote host
            • Return the connection id
            • Convert a Pandas DataFrame to SASdata format
            • Return the PID of the SAS process
            • Convert a pandas DataFrame to a Pandas DataFrame
            • Generate code for code
            • Impute the SAS data
            • Download file from remote host
            • Download a file
            Get all kandi verified functions for this library.

            saspy Key Features

            No Key Features are available at this moment for saspy.

            saspy Examples and Code Snippets

            No Code Snippets are available at this moment for saspy.

            Community Discussions

            QUESTION

            allocate libname saspy python SASmagic command
            Asked 2022-Mar-14 at 15:50

            While using SaSPy, how can I find where the library RWORK is located ?
            I tried sas.dirlist() but without being able to find anything.
            It might be due to remote access?

            Below is my setup connexion

            ...

            ANSWER

            Answered 2022-Mar-14 at 15:50

            I suspect SASPy can't see the remote as you say. You can certainly find out by running code in SAS, just run this inside the rsubmit block:

            Source https://stackoverflow.com/questions/71469356

            QUESTION

            How to utilize subprocess when invoking sas code in python on Linux server
            Asked 2022-Jan-26 at 21:17

            I am trying to run a SAS program on linux using python. This server has SAS installed (version 9.4). And python version I have is 3.7.3.

            I learned there is a library saspy which I could use however my project does not have access to this library. So, I found another alternative, my intension is to invoke the sas program in python and get the return code when it is successfully completed. This Sas program usually takes 1hr to complete.

            So, I would like to use the return code when it is successful and later would like to notify myself through an email. I wrote the below code (sample) and I unable to make the subprocess work ? Any help is appreciated. Thanks

            ...

            ANSWER

            Answered 2022-Jan-26 at 16:56

            subprocess.call is an older method of doing this, but it should work; per the documentation, you need to use the returncode attribute to access the return code.

            You may be better off using subprocess.run(), which returns a CompletedProcess instance.

            Either way, you probably should ensure that your shell command (which looks like a .bat file) actually returns the value from the SAS execution. If it uses call, for example (in Windows batch script), it may actually be running SAS in the background - which is consistent with what you're describing here, and also consistent with the filename (BGsas). You may want to use a different script to launch SAS in the foreground.

            Source https://stackoverflow.com/questions/70858516

            QUESTION

            SASpy file_delete Method
            Asked 2021-Apr-22 at 19:13

            Does anyone has used the file_delete() method of SASpy? I'm trying to delete a file in SAS Server side using this method but I was unable to make it works.

            ...

            ANSWER

            Answered 2021-Apr-22 at 19:13

            I just tested this. In 3.3.7 this is not available; in 3.6.6 it is available. I'm not sure exactly what version it was added in (most likely 3.5.0, that seemed to be a big update), but most likely you just need to run:

            Source https://stackoverflow.com/questions/67214573

            QUESTION

            Issue while reading SQL output into SAS dataset using Python
            Asked 2021-Jan-20 at 02:36

            I am trying to read SQL query output and create a SAS dataset using Python pandas. My SQL query is executing properly but only importing column names into SAS dataset due to data shifting. It is an encoding issue and I wanted some guidance on how to fix this. Below is my code:

            ...

            ANSWER

            Answered 2021-Jan-20 at 02:33

            First, I'm going to guess that you might have some embedded newline characters in the data.

            See this github issue which has the same error message as you have. (Also note the detail in the initial post - this is about what your initial post should have looked like!)

            If you have at least SASPy version 3.1.4, you should have an option embedded_newlines=true you can set, the example code:

            sas.dataframe2sasdata(df=problematic_data,table='via_sas_test_prob',libref='OUT', embedded_newlines=True)

            (that is an alias for df2sd, by the way). Hopefully that works in Viya; SASPy mostly runs base (MVA) SAS, so I don't know what things are different in Viya (and don't have Viya). If you don't have 3.1.4 or newer, then update your SASPy.

            Another option would be to remove the newline (\n) characters in Python before transferring the data over. That's what the user in the github issue does.

            Second, if you're running things in Viya, consider using python-SWAT, which is the SAS Viya scripting library in Python. It submits things as CAS actions, which might be better for you.

            Finally, a third option would be to run the database connection piece in SAS. Unless you didn't license ACCESS to ODBC, of course, but if you do license that, then I'd consider moving that piece to SAS and just telling SAS to input the file itself.

            Source https://stackoverflow.com/questions/65798322

            QUESTION

            How to specify LIBREF in SASPy when turning a SAS table into a Python Dataframe
            Asked 2020-Aug-25 at 17:59

            Please see the image below for my SAS Server Layout. I would like to pull the top table 2020_01_SETTLEMENTS and place it into a Python data frame. I have successfully established connection between Python and the SAS Server. I have the following code below but I believe where I am going wrong is in the LIBREF part of the sasdata2dataframe function. I have listed the error message below as well. Much appreciated to anyone who can tell me where I went wrong. I've also linked the reference material to this function here:

            https://sassoftware.github.io/saspy/api.html

            Code:

            ...

            ANSWER

            Answered 2020-Aug-11 at 21:53

            Although as it is not specified in the manual, I ended up using the following code instead and it worked. I just changed table: str = '2020_01_SETTLEMENTS' to table='2020_01_SETTLEMENTS'

            Source https://stackoverflow.com/questions/63347312

            QUESTION

            How to connect Python to a SAS Enterprise Guide (EG) Server
            Asked 2020-Aug-10 at 21:50

            For normal SAS software, one can use the Python package SASPy inorder to connect to a SAS server, retrieve data and manipulate the data with Python code. However, this package does not seem to work for SAS EG. Does anyone know how to import data from SAS EG servers in a Python IDE?

            For example:

            ...

            ANSWER

            Answered 2020-Aug-10 at 21:50

            This hyperlinked document was very helpful in allowing me to figure this out. It required two files. One cfg file to host the server info. And another file to create a SASsession that referenced the cfg file. For the Windows IOM server I used the code below:

            https://sassoftware.github.io/saspy/install.html#choosing-an-access-method

            Source https://stackoverflow.com/questions/63268911

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install saspy

            This module can be installed via pip or Conda. This will pull down the latest PyPI package and install it. However, if that's too easy, you can also download a specific release from SASpy project releases page, or just clone the repo and and instll from that. To install a given release, use the following, where the X.X.X is the release version you want.
            All of the doc, including install and configuration information can be found at sassoftware.github.io/saspy. Also, example Notebooks and use cases can be found at sassoftware/saspy-examples.

            Support

            The Contributing file explains the rules and conventions to follow while Contributing to this project. It also contains the Contributor Agreement instructions.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install saspy

          • CLONE
          • HTTPS

            https://github.com/sassoftware/saspy.git

          • CLI

            gh repo clone sassoftware/saspy

          • sshUrl

            git@github.com:sassoftware/saspy.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Code Editor Libraries

            vscode

            by microsoft

            atom

            by atom

            coc.nvim

            by neoclide

            cascadia-code

            by microsoft

            roslyn

            by dotnet

            Try Top Libraries by sassoftware

            python-dlpy

            by sassoftwarePython

            sas_kernel

            by sassoftwareJupyter Notebook

            python-swat

            by sassoftwarePython

            sas-viya-programming

            by sassoftwareJupyter Notebook

            sas-container-recipes

            by sassoftwareShell