Data Science with SAS
Data Science with SAS has always been an add-on skill for Data Scientists who wants familiarity not only with SQL, Python and R but also with the Statistical Analysis System which is commonly abbreviated as SAS. Though it is less likely used as a primary analytical tool in the field of Data Science, but SAS provides a number of products to its users which can change the perception of it is used as a primary tool rather than an add on skill by the experts. Some of these include Asset Performance Analytics, Analytics for IoT, Business Rules Manager, Customer Intelligence and Decision Management Solutions and Econometrics.
In this Data Science with SAS Certification Course Tutorial, learners will get an introduction to SAS, SAS Operators and Functions, SAS Procedures, SAS Format, SAS Macros, Advanced Base SAS and much more. Not only these, but they will also get hands-on exercises on different SAS concepts such as Using PROC SORT for sorting the results, listing ODS, finding mean using PROC Means and print using PROC PRINT.
At the end of this Data Science with SAS training by Uplatz, learners will be able to upgrade their skills on Data Science with SAS alongside other analytical tools.
------------------------------------------------------------------------------------------------------------
Data Science with SAS
Introduction to SAS
Installation and introduction to SAS, how to get started with SAS, understanding different SAS windows, how to work with data sets, various SAS windows like output, search, editor, log and explorer and understanding the SAS functions, which are various library types and programming files
SAS Enterprise Guide
How to import and export raw data files, how to read and subset the data sets, different statements like SET, MERGE and WHERE
Hands-on Exercise: How to import the Excel file in the workspace and how to read data and export the workspace to save data
SAS Operators and Functions
Different SAS operators like logical, comparison and arithmetic, deploying different SAS functions like Character, Numeric, Is Null, Contains, Like and Input/Output, along with the conditional statements like If/Else, Do While, Do Until and so on
Hands-on Exercise: Performing operations using the SAS functions and logical and arithmetic operations
Compilation and Execution
Understanding about input buffer, PDV (backend) and learning what is Missover
Using Variables
Defining and using KEEP and DROP statements, apply these statements and formats and labels in SAS
Hands-on Exercise: Use KEEP and DROP statements
Creation and Compilation of SAS Data Sets
Understanding the delimiter, dataline rules, DLM, delimiter DSD, raw data files and execution and list input for standard data
Hands-on Exercise: Use delimiter rules on raw data files
SAS Procedures
Various SAS standard procedures built-in for popular programs: PROC SORT, PROC FREQ, PROC SUMMARY, PROC RANK, PROC EXPORT, PROC DATASET, PROC TRANSPOSE, PROC CORR, etc.
Hands-on Exercise: Use SORT, FREQ, SUMMARY, EXPORT and other procedures
Input Statement and Formatted Input
Reading standard and non-standard numeric inputs with formatted inputs, column pointer controls, controlling while a record loads, line pointer control/absolute line pointer control, single trailing, multiple IN and OUT statements, dataline statement and rules, list input method and comparing single trailing and double trailing
Hands-on Exercise: Read standard and non-standard numeric inputs with formatted inputs, control while a record loads, control a line pointer and write multiple IN and OUT statements
SAS Format
SAS Format statements: standard and user-written, associating a format with a variable, working with SAS Format, deploying it on PROC data sets and comparing ATTRIB and Format statements
Hands-on Exercise: Format a variable, deploy format rule on PROC data set and use ATTRIB statement
SAS Graphs
Understanding PROC GCHART, various graphs, bar charts: pie, bar and 3D and plotting variables with PROC GPLOT
Hands-on Exercise: Plot graphs using PROC GPLOT and display charts using PROC GCHART
Interactive Data Processing
SAS advanced data discovery and visualization, point-and-click analytics capabilities and powerful reporting tools
Data Transformation Function
Character functions, numeric functions and converting variable type
Hands-on Exercise: Use functions in data transformation
Output Delivery System (ODS)
Introduction to ODS, data optimization and how to generate files (rtf, pdf, html and doc) using SAS
Hands-on Exercise: Optimize data and generate rtf, pdf, html and doc files
SAS Macros
Macro Syntax, macro variables, positional parameters in a macro and macro step
Hands-on Exercise: Write a macro and use positional parameters
PROC SQL
SQL statements in SAS, SELECT, CASE, JOIN and UNION and sorting data
Hands-on Exercise: Create SQL query to select and add a condition and use a CASE in select query
Advanced Base SAS
Base SAS web-based interface and ready-to-use programs, advanced data manipulation, storage and retrieval and descriptive statistics
Hands-on Exercise: Use web UI to do statistical operations
Summarization Reports
Report enhancement, global statements, user-defined formats, PROC SORT, ODS destinations, ODS listing, PROC FREQ, PROC Means, PROC UNIVARIATE, PROC REPORT and PROC PRINT
Hands-on Exercise: Use PROC SORT to sort the results, list ODS, find mean using PROC Means and print using PROC PRINT
---------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
Data Science with SAS Interview Questions
-----------------------------------------------------------------------------------------------------------
1) What is SAS? What are the functions does it performs?
SAS means Statistical Analysis System, which is an integrated set of software products.
• Information retrieval and data management
• Writing reports and graphics
• Statistical analytics, econometrics and data mining
• Business planning, forecasting, and decision support
• Operation research and Project management
• Quality Improvement
• Data Warehousing
• Application Development
2) What is the basic structure of the SAS base program?
The basic structure of SAS consist of
==DATA step, which recovers & manipulates data.
==PROC step, which interprets the data.
3) What is the basic syntax style in SAS?
To run the program successfully, and you have the following basic elements:
• There should be a semi-colon at the end of every line
• A data statement that defines your data set
• Input statement
• There should be at least one space between each word or statement
• A run statement
For example: In file ‘H: \StatHW\yourfilename.dat’;
4) Explain data step in SAS
The Data step creates a SAS dataset which carries the data along with a “data dictionary.” The data dictionary holds information about the variables and their properties.
5) What is PDV?
The logical area in the memory is represented by PDV or Program Data Vector. At the time, SAS creates a database of one observation at a time. An input buffer is created at the time of compilation which holds a record from an external file. The PDV is created following the input buffer creation.
6) What are the data types does SAS contain?
The data types in SAS are Numeric and Character.
7) Which statement does not perform automatic conversions in comparisons?
In SAS, the “where” statement does not perform automatic conversions in comparisons.
8) What is a method to debug and test your SAS program?
You can debug and test your SAS program by using Obs=0 and systems options to trace the program execution in log
9) What is the difference between nodupkey and nodup options?
The difference between the NODUP and NODUPKEY is that NODUP compares all the variables in our dataset while NODUPKEY compares just the BY variables
10) Name validation tools used in SAS
For DataSet : Data set name/ debug Data set: Name/stmtchk
For SAS Macros variables: Options: mprint mlogic symbolgen
11) What does PROC print, and PROC contents do?
To display the contents of the SAS dataset PROC print is used and also to assure that the data were read into SAS correctly. While PROC CONTENTS display information about a SAS dataset.
12) What is the use of function Proc summary?
The syntax of proc summary is the same as that of proc means. It computes descriptive statistics on numeric variables in the SAS dataset.
13) What Proc glm does?
Proc glm performs simple and multiple regression, analysis of variance (ANOVAL), analysis of covariance, multivariate analysis of variance and repeated measure analysis of variance.
14) What is SAS informats?
SAS INFORMATS are used to read, or input data from external files known as Flat Files ASCII files, text files or sequential files). The informat will tell SAS on how to read data into SAS variables.
15) Name types of category in which SAS Informats are placed
SAS informats are placed in three categories,
• Character Informats : $INFORMATw
• Numeric Informats : INFORMAT w.d
• Date/Time Informats: INFORMAT w.
16) What function CATX syntax does?
CATX syntax concatenates character strings remove trailing and leading blanks and inserts separators.
17) What is the use of PROC gplot?
PROC gplot has more options and can create more colorful and fancier graphics.
18) What is PROC in SAS?
In SAS, PROC steps analyze and process data in the form of an SAS data set. It controls a library of routines that perform tasks on SAS data set options such as sorting, summarizing and listing.
19) What is the SAS data set?
A SAS data set is a file consisting of two parts.
• A descriptor portion
• A data portion
20) List out some key concept of SAS
Some key concept of SAS include,
• SORT procedure
• Missing values
• KEEP=, DROP= dataset options
• Data step logic
• Reset to missing, or the RETAIN statement
• Log
• FORMAT procedure for creating value formats
• Data types
• IN= dataset option
21) What is the difference between INPUT and INFILE?
•INFILE statement is used to identify an external file
• INPUT statement is used to describe your variables
22) State the difference between INFORMAT and FORMAT ?
• INFORMAT: To indicate SAS that a number should be read in a particular format
• FORMAT: To indicate SAS how to print the variables
23) What is factor analysis?
Factor analysis is a common term used for a family of statistical techniques associated with the reduction of a set of observable variables in terms of a small number of latent factors. The main goal of factor analysis is data reduction and summarization.
24) How you can read the variables that you need?
You read the variables using input statement with column /line pointers, informats and length specifiers.
25) What are the special input delimiters used in SAS?
Special input delimiters used in SAS are DLM and DSD.
26) How SAS treats the DSD delimiters?
When you define DSD, SAS treats two consecutive delimiters as a missing value and removes quotation marks from character values.
27) What is the good SAS programming practices for processing large data sets?
The good SAS programming practices for processing large data sets is to sort them once using firstobs= and obs=
28) How to include or exclude specific variables in a data set?
To include or exclude specific variables in a data set you can use DROP, KEEP Statements and Data set Options.
29) How SUBSTR function works in SAS?
The SUBSTR function is used to abstract substring from a character variable.
30) What SAS features do you use to check errors and data validation?
To check errors, use the Log, and for data validation use things like Proc Freq, Proc Means or sometimes Proc print to see how data looks.
31) What are the ways to do a “table lookup” in SAS?
There are five ways to do a “table lookup” in SAS which include:
1. PROC SQL
2. Match Merging
3. Direct Access
4. Format Tables
5. Arrays
32) How will you generate test data with no input data?
You will generate test data with no input data using “put” statement and “Data Null”.
33) What are the difference between CEIL and FLOOR functions in SAS?
The “floor” returns the greatest integer less than/equal to the argument. Whereas the “ceil” function returns the smallest integer greater than/equal to the argument.
34) What are the difference between SAS functions and procedures?
The difference between SAS functions and procedures is that
• Procedures expect one variable value per observation
• Functions expect values to be supplied across an observation
35) How to remove duplicates using PROC SQL?
To remove duplicates using PROC SQL use following step,
Proc SQL noprint;
Create Table inter.merged1 as
Select distinct * from inter.readin ;
Quit;
36) What are common programming errors committed in SAS
Common programming errors committed in SAS are,
• Missing semicolon
• Not checking log after submitting program
• Not using debugging techniques
• Not using Fsview option vigorously
37) How to limit decimal places for the variable using PROC MEANS?
By using MAXDEC=option, you can limit decimal places for the variable.
38) What are the difference between the SAS DATA STEP and SAS PROCs?
• SAS DATA STEP is used to read in and manipulate data
• SAS PROCs are sub-routines perform tasks on SAS data set
39) What is the use of STOP statement?
A STOP statement is used to control the continuous looping in SET statement.
40) What is RUN-Group processing?
RUN-Group processing allows submitting a PROC step using RUN statement without ending the procedure.
41) How to test the debugging in SAS?
For debugging in SAS use the Debug clause after ‘/’ in the data statement.
42) How to create a permanent SAS data set?
In order to create a permanent SAS data set, there are two steps necessary,
• Assign a library and engine.
• Create the data. Make sure to assign both a library (other than WORK) and data set name to make the data set permanent.
43) What is SLIBREF?
SLIBREF is a server-libref. It specifies the libref that is used by the server to identify the SAS data library when no physical name is determined, and the server libref is different from the client libref.
44) What are the default statistics that PROC MEANS produce?
The default statistics that PROC MEANS produce are,
• N
• MN
• MAX
• MEAN
• STD DEV
45) What is the command used to find missing values?
The command used to find missing values is
missing_values=MISSING(field1,field2,field3);
46) What is the difference between Match Merge and One to One Merge?
A one-to-one merge is suitable if both data sets in the merge statement are sorted by id, and each observation in one data set has a corresponding observation in the other data set. If the observations do not match, then match merging is suitable.
47) What are the scrubbing procedures in SAS?
The scrubbing procedures in SAS are Proc Sort with nodupkey option. It will eliminate duplicate values.
48) What is the use of the %include statement?
%INCLUDE statement reads an entire file into the current SAS program you are running and submits that file to the SAS System immediately.
-----------------------------------------------------------------------------------------------------------