SAS Viya

Book description

Learn how to access analytics from SAS Cloud Analytic Services (CAS) using Python and the SAS Viya platform.SAS Viya : The Python Perspective is an introduction to using the Python client on the SAS Viya platform. SAS Viya is a high-performance, fault-tolerant analytics architecture that can be deployed on both public and private cloud infrastructures. While SAS Viya can be used by various SAS applications, it also enables you to access analytic methods from SAS, Python, Lua, and Java, as well as through a REST interface using HTTP or HTTPS. This book focuses on the perspective of SAS Viya from Python. SAS Viya is made up of multiple components. The central piece of this ecosystem is SAS Cloud Analytic Services (CAS). CAS is the cloud-based server that all clients communicate with to run analytical methods. The Python client is used to drive the CAS component directly using objects and constructs that are familiar to Python programmers. Some knowledge of Python would be helpful before using this book; however, there is an appendix that covers the features of Python that are used in the CAS Python client. Knowledge of CAS is not required to use this book. However, you will need to have a CAS server set up and running to execute the examples in this book. With this book, you will learn how to:
  • Install the required components for accessing CAS from Python
  • Connect to CAS, load data, and run simple analyses
  • Work with CAS using APIs familiar to Python users
  • Grasp general CAS workflows and advanced features of the CAS Python client

SAS Viya : The Python Perspective covers topics that will be useful to beginners as well as experienced CAS users. It includes examples from creating connections to CAS all the way to simple statistics and machine learning, but it is also useful as a desktop reference.

Table of contents

  1. Foreword
  2. About This Book
  3. About These Authors
  4. Chapter 1: Installing Python, SAS SWAT, and CAS
  5. Installing Python
  6. Installing SAS SWAT
  7. Installing CAS
  8. Making Your First Connection
  9. Conclusion
  10. Chapter 2: The Ten-Minute Guide to Using CAS from Python
  11. Importing SWAT and Getting Connected
  12. Running CAS Actions
  13. Loading Data
  14. Executing Actions on CAS Tables
  15. Data Visualization
  16. Closing the Connection
  17. Conclusion
  18. Chapter 3: The Fundamentals of Using Python with CAS
  19. Connecting to CAS
  20. Running CAS Actions
    1. Specifying Action Parameters
    2. CAS Action Results
    3. Working with CAS Action Sets
  21. Details
    1. Getting Help
    2. Dealing with Errors
    3. SWAT Options
    4. CAS Session Options
  22. Conclusion
  23. Chapter 4: Managing Your Data in CAS
  24. Overview
  25. Getting Started with Caslibs and CAS Tables
    1. Loading Data into a CAS Table
    2. Displaying Data in a CAS Table
    3. Computing Simple Statistics
    4. Dropping a CAS Table
    5. CAS Data Types
    6. Caslib and CAS Table Visibility
    7. The Active Caslib
  26. Uploading Data Files to CAS Tables
  27. Uploading Data from URLs to CAS Tables
  28. Uploading Data from a Pandas DataFrame to a CAS Table
  29. Using Data Message Handlers
    1. The HTML Data Message Handler
    2. The Excel Data Message Handler
    3. The PandasDataFrame Data Message Handler
    4. Using Data Message Handlers with Databases
  30. Writing Your Own Data Message Handlers
    1. Variable Definition Details
    2. Adding Data Transformers
  31. Managing Caslibs
    1. Creating a Caslib
    2. Setting an Active Caslib
    3. Dropping a Caslib
  32. Conclusion
  33. Chapter 5: The CASAction and CASTable Objects
  34. Getting Started with the CASAction Objects
    1. Setting Nested Parameters
    2. Setting Parameters as Attributes
    3. Retrieving and Removing Action Parameters
  35. First Steps with the CASTable Object
    1. Manually Creating a CASTable Object
    2. CASTable Action Interface
    3. Setting CASTable Parameters
    4. Managing Parameters Using the Method Interface
    5. Managing Parameters Using the Attribute Interface
    6. Materializing CASTable Parameters
  36. Conclusion
  37. Chapter 6: Working with CAS Tables
  38. Using CASTable Objects like a DataFrame
    1. CAS Table Introspection
    2. Computing Simple Statistics
    3. Creating Plots from CASTable Data
    4. Exporting CASTables to Other Formats
  39. Sorting, Data Selection, and Iteration
    1. Fetching Data with a Sort Order
    2. Iterating through Columns and Rows
    3. Techniques for Indexing and Selecting Data
  40. Data Wrangling on the Fly
    1. Creating Computed Columns
    2. BY-Group Processing
  41. Conclusion
  42. Chapter 7: Data Exploration and Summary Statistics
  43. Overview
  44. Summarizing Continuous Variables
    1. Descriptive Statistics
    2. Histograms
    3. Percentiles
    4. Correlations
  45. Summarizing Categorical Variables
    1. Distinct Counts
    2. Frequency
    3. Top K
    4. Cross Tabulations
  46. Variable Transformation and Dimension Reduction
    1. Variable Binning
    2. Variable Imputation
  47. Conclusion
  48. Chapter 8: Modeling Continuous Variables
  49. Linear Regressions
  50. Extensions of Ordinary Linear Regression
    1. Generalized Linear Models
    2. Regression Trees
  51. Conclusion
  52. Chapter 9: Modeling Categorical Variables
  53. Logistic Regression
  54. Decision Trees
  55. Gradient Boosting, Forests, and Neural Networks
  56. Conclusion
  57. Chapter 10: Advanced Topics
  58. Binary vs. REST Interfaces
    1. The Binary Interface
    2. The REST Interface
    3. The Pros and Cons of Each Interface
  59. Result Processing Workflows
    1. The Easy Way
    2. Using Response and Result Callback Functions
    3. Handling Responses from Multiple Sessions Simultaneously
  60. Connecting to Existing Sessions
  61. Communicating Securely
  62. Conclusion
  63. Appendix A: A Crash Course in Python
  64. IPython and Jupyter
  65. Data Types and Collections
    1. Numeric Data Types
    2. Character Data Types
    3. Booleans
    4. Lists and Tuples
    5. Other Types
  66. Flow Control
    1. Conditional Code
    2. Looping
  67. Functions
  68. Classes and Objects
  69. Exceptions
  70. Context Managers
  71. Using the Pandas Package
    1. Data Structures
    2. Data Selection
  72. Creating Plots and Charts
    1. Plotting from Pandas DataFrame Methods
    2. Plotting DataFrames with Plotly and Cufflinks
    3. Creating Graphics with Matplotlib
    4. Interactive Visualization with Bokeh
  73. Conclusion
  74. Appendix B: Troubleshooting
  75. Software Version Issues
  76. Connection Issues
    1. Missing Linux Library Dependencies
    2. Incorrect SAS Threaded Kernel Configuration
    3. Unable to Import _pyXXswat
    4. Refused Connection
    5. Authentication Problems
  77. Index

Product information

  • Title: SAS Viya
  • Author(s): Kevin D. Smith, Xiangxiang Meng
  • Release date: February 2018
  • Publisher(s): SAS Institute
  • ISBN: 9781629608839