I am a coder, and focus on machine learning now. for some reason, I learned SAS 2 years ago, for a coder,Â SAS language is very strange, but I had to learn it. when I am familiar with it, I have to learn Python now.
So I collect some useful resources here,
Comparison with SAS
It is a very useful article from pandas docs,
For potential users coming fromÂ SASÂ this page is meant to demonstrate how different SAS operations would be performed in pandas.
Python For SAS Users
An Introduction to Python for SAS Users
The goal for this content is to permit business users familiar with Base SAS programming to learn Python. The examples provided map SAS programming constructs and coding patterns into their Python equivalents. The primary focus is on pandas and data management issues related to analysis of data.
If you are already familiar with Python you can skip the first three chapters. If you are not familiar with it, make sure to learn how to update python first.
Python for SAS Users: The pandas Data Analysis Library
This post isÂ a chapterÂ from Randy Betancourtâ€™sÂ Python for SAS UsersÂ quick start guide. Randy wrote this guide to familiarize SAS users with Python and Pythonâ€™s various scientific computing tools.
SAS vs. Python â€“ How Do They Compare?
When you see an interesting data set, report, or figure, do you wonder what it would take to replicate those outputs in SASÂ®? This paper will do just that, by using SASÂ® to recreate a complex graph that was originally generated by Python.
A key concept for understanding this comparison is that the starting point is the Python code. The paper will associate snippets of Python with the corresponding SASÂ® statements, attempting a reasonable apples-to-apples comparison. In other words, the resulting SASÂ® code will not necessarily represent how it would have been written if we had started with SASÂ® rather than Python. The objective of the paper is to show SASÂ® programmers how SASÂ® code lines up with the widely used Python language.
We will start with a brief summary of how SASÂ® and Python compare across several environmental dimensions. The code comparison will be broken down into the following task areas:
- Â Data manipulation
- Â Data aggregation
- Â Logic
- Â Graphing
The comparison will be summarized by the following measures:
- Lines of code
- Run time
The appendices contain the complete programs and the output graphs.
Data manipulation in Python for SAS users, with the %%sasx magic command.
SASX (Simple dAta SyntaX) has the best of both worlds: – Classic python syntax with access to python, numpy, pandas (like Python) – A few extra keywords to allow easy row-by-row operations (like SAS)
Install the latest release with:pip install sasx
Why SAS Programmers Should Learn Python Too
Â Â Â Day to day work can often require simple, yet repetitive tasks. All companies have tedious processes that may involve moving and renaming files, making redundant edits to code, and more. Often, one might also want to find or summarize information scattered amongst many different files as well. While SAS programmers are very familiar with the power of SAS, the power of some lesser known but readily available tools may go unnoticed.
The programming language Python has many capabilities that can easily automate and facilitate these tasks. Additionally, many companies have adopted Linux and UNIX as their OS of choice. With a small amount of background, and an understanding of Linux/UNIX command line syntax, powerful tools can be developed to eliminate these tedious activities. Better yet, these tools can be written to â€œtalk backâ€ to the user, making them more user friendly for those averse to venturing from their SAS editor. This paper will explore the benefits of how Python can be adopted into a SAS programming world.
TheÂ SASPyÂ package enables you to connect to and run your analysis from SAS 9.4 using the object-oriented methods and objects from the Python language as well as the Python magic methods. SASPy translates the objects and methods added into the SAS code before executing the code. To use SASPy, you must have SAS 9.4 and Python 3.x or later.
How to code in Python with SAS 9.4
The SASÂ® platform is now open to be accessed from open-source clients such as Python, Lua, Java, the R language, and REST APIs to leverage the capabilities of SASÂ® ViyaÂ® products and solutions. You can analyze your data in a cloud-enabled environment that handles large amounts of data in a variety of different formats. To find out more aboutÂ SAS Viya, see the â€œSAS Viya: What’s in it for me? The user.â€ article.
This blog post focuses on the openness of SASÂ® 9.4 and discusses features such as the SASPy package and the SAS kernel for Jupyter Notebook and more as clients to SAS. Note: This blog post is relevant for all maintenance releases of SAS 9.4.
Read SAS files stored as either XPORT or SAS7BDAT format files.
SparkSQL SAS (sas7bdat) Input Library
A library for parsing SAS data (sas7bdat) withÂ Spark SQL. This also includes aÂ
SasInputFormatÂ designed for Hadoop mapreduce. This format is splittable when input is uncompressed thus can achieve high parallelism for a large SAS file.
This library is inspired byÂ spark-csvÂ and currently usesÂ parsoÂ for parsing as it is the only public available parser that handles both forms of SAS compression (CHAR and BINARY).
and here is a tutorial aboutÂ How two read SAS data with PySpark.