Introduction to SAS
Introduction to SAS Language
What is SAS?
• SAS (Statistical Analysis System
• Software suite developed by SAS Institute for
advanced analytics, business intelligence, data
management, and predictive analytics
• Developed at North Carolina State University from
1966 until 1976, when SAS Institute was
incorporated.
• Further developed in the 1980s and 1990s with
the additional statistical procedures and
components
Components of SAS
Currently, SAS has more than 200 components,
some of them are –
• Base SAS – Basic procedures and data
management
• SAS/STAT – Statistical analysis
• SAS/GRAPH – Graphics and presentation
• SAS/OR – Operations research
• SAS/ETS – Econometrics and Time Series Analysis
• SAS/IML – Interactive matrix language
SAS University Edition
http://www.sas.com/en_in/software/university-edition/download-software.html
https://welcomedata.wordpress.com/2015/03/13/downloading-and-installing-sas-university-edition/
SAS Interface
• Code Editor where we write and modify mode
• Log is a record of everything that we do in SAS
session or SAS program :-
– Program statements identified by line numbers
– Messages that begin with NOTE, INFO, WARNING,
ERROR, or an error number
– Process time
• Result displays printed output
SAS Code Editor
SAS Log
SAS Result
SAS Explorer
• All libraries, folders ,
files that include data,
saved code and saved
output can be found
here
SAS Language
• SAS program consists of SAS Statements
• Each SAS Statement end with a semi-colon (;)
• Basic SAS Statements are :
– Data Step
– Proc Step
DATA Step – used to create or modify data sets
PROC Step (Procedure) - pre-written rules that analyze
and process data in a SAS dataset and then produce a
report
SAS Language
• A SAS program can consist of a DATA step or a
PROC step or any combination of DATA and
PROC steps.
• Data Step and Proc Step are followed by Run
Statement.
• SAS statements are free-format –
– they can begin and end anywhere on a line
– one statement can continue over several lines
• To Comment use (/*Comment*/)
Class Assignment
Create a cheat sheet for yourself of the code
that you run in the class.
Add short comments for each program or each
new step.
Submit the cheat sheet at the end of the class.
Create Temporary Data set
i. There are six SAS statements.
ii. DATA step – creates a new dataset
called first.
iii. PROC step – prints/displays that dataset in
the results/output window.
PROC Step
• Proc PRINT
• Proc DATASETS
• Proc CONTENTS
• Proc SORT
• Proc FREQ
• Proc MEANS
• Proc UNIVARIATE
• Proc CORR
Create Temporary Data set
• Input Statement –
– Input variable names,
– Describes arrangement of values in the
input data record and assigns
• Datalines/Cards Statement indicates
that existence of data lines below
In the above program:
i. There are seven SAS statements;
ii. The INPUT statement defines the variables to
be read in each line of data.
iii. The DATALINES statement indicates to SAS
that DATA step statements are completed and
the next line contains real data.
iv. Notice that the lines of data do not end in a
semicolon.
Create Temporary Data set
Missing values for Character variable o?
Let us check Log for errors
Create Temporary Data set
For character variable add “$” after variable name in Input statement
SAS Options
Here, PROC
step prints
only the
first 4
observation
s of the data
set third
SAS Options
Here, PROC step
prints the data
set third
beginning with
observation 2
till observation
4
SAS Libraries
Permanent Libraries (Default) –
• SASHELP – contains sample data
sets
• SASUSER – stores personal files
Temporary Library –
WORK – stores files only for current
session
SAS Files
Rules for data set names –
• i. 1 to 32 characters
• ii. must begin with an alphabet A-Z(uppercase or lowercase) or
underscore
• ii. can continue with any combination of alphabets, numbers or
underscores
Referencing SAS Files
• Two-Level Names
• To reference a permanent SAS data set in your SAS programs, we
use a two-level name
• library name and the filename, or data set name:
• libref.filename
PROC Datasets
PROC DATASETS is used
• to list, copy, remove, or delete SAS files.
• to change variable information such as name,
format, informat and label.
PROC Datasets does not require RUN Statement
PROC Datasets
The SAS log gives the name of all SAS datasets in the
library called SASHELP
PROC Datasets – CHANGE Statement
In the following program, we change the name of
dataset first to one using CHANGE Statement.
PROC Datasets – DELETE
Statement
In the following program, we delete dataset one
using DELETE Statement.
Create data set using existing datasetrun
• Use SET Statement and create a temporary data set for use
in current session from an existing data set
• Print the new data set using PROC Print
• Try and see what the following program will do
PROC Print – TITLE
As the name suggests, TITLE Statements adds Title
while printing the output.
PROC Print – SUM
To generate Column totals use SUM Statement
within PROC Step
PROC Sort
Here, PROC Sort is used to create a sorted
dataset in ascending order according to team
variable.
Calculate Subtotals
Here, we calculate and print Subtotals for nhits
sorted by variable team.
PROC Contents
PROC Contents -
• provides information for SAS datasets or libraries
• it gives the name of the dataset or library, the
location, when it was created, the host that
created it, and the time of the last modification.
• For datasets it also provides the number of
observations in the dataset, and attributes for
each variable
PROC Contents
The following program requests information for sashelp.baseball
dataset using PROC Contents.
PROC Freq
PROC FREQ –
• Counts the number (frequency) of occurrences of
each variable(both character and numeric).
• Gives statistics from the data
• Produces one- way to n-way frequency and cross-
tabulation tables.
• Produces printed output by default.
• Lists each variable value along with the
frequencies and percentages.
PROC Freq
The following program demonstrates the
simplest form of PROC FREQ and produces the output
The output of this program is too long for our purpose to include here.
Add TABLES Statement to limit the output for only one
variable and create a one-way frequency table
PROC Freq
Create two-way cross-tabulation tables :
In the TABLES statement, state the variable names
separated by asterisk
PROC Means
PROC MEANS –
• produces statistics for numeric variables.
• produces printed output by default
• computes N, MEAN, STD, MIN and MAX by
default
• similar to PROC SUMMARY however, PROC
SUMMARY does not produce a printed output
by default.
PROC Means
The following shows simplest use of PROC MEANS procedure.
PROC Means – VAR
VAR statement –
• selects specified variable ,
• Identifies the analysis variables and their order in the output.
PROC Means – Statistic
To obtain a specific statistic you must state it in the PROC
MEANS statement.
PROC Means – Class
• The CLASS statement assigns variables used to form subgroups.
• CLASS variables can be either numeric or character.
PROC Means – Output
Output Statement stores result in new data set.
Here, the new data set is baseball_new.
PROC Univariate
PROC UNIVARIATE
• Examines distribution for numeric variables.
• produces printed output by default
The following shows simplest use of PROC Univariate procedure.
PROC Univariate – NORMAL
NORMAL Option requests for tests for normality that include a series of
goodness-of-fit tests based on the empirical distribution function.
PROC Univariate – PLOT
PLOT Option in PROC Univariate produces a stem-
and-leaf plot (or a horizontal bar chart), a box
plot, and a normal quantile plot
PROC Univariate – PLOT
DO Loops
Incrementing Loop
Here the i is being incremented by 2 in the loop
Dropping Variable
Here, we create a dataset Sixth. We run a loop
using a new variable i, but drop it so that it
does not include in the dataset.
Decrementing Loop
Here the i is being decremented by 2 in the loop
Dataset using Raw file
1. Create a new folder in myfolders and call it
mine.
2. Use libname statement to create a new SAS
library called mine. How do we get the path
of mine?
Dataset using Raw file
3. Upload diamonds.csv dataset into the mine
folder
4. Check the folder
PROC Import
We use Proc IMPORT to import the dataset.
• OUT Option specifies a name for SAS data set
• DATAFILE Statement specifies the location/path of the uploaded
file.
• DBMS Statement indicates the type of uploaded file.
• GETNAMES Statement tells SAS whether the first row of the data
values is to be considered as variable names or not(Yes - if to be
considered as variable names).
Dataset using Raw file
Check the MINE Library
Create a temporary data set called diamonds,
using the existing data set.
PROC Corr
Correlation is one of the first steps to
understand the relationship between
variables. To compute correlation in SAS, we
use PROC CORR.
Corr Procedure calculates pairwise correlation
for Numeric variables. This procedure also
provides some summary statistics by default -
Mean, Standard Deviation, Sum, Minimum and
Maximum.
Assignment
Make use of the procedures learnt in the class
to compute statistics for diamonds data set.
https://vincentarelbundock.github.io/Rdatasets/csv/Ecdat/Diamond.csv
SAS DOCUMENTATION = Hallelujah!
http://support.sas.com/documentation/
PROC SQL
http://www2.sas.com/proceedings/sugi27/p191-27.pdf
PROC SQL
MACRO LANGUAGE
https://v8doc.sas.com/sashtml/macro/znemacro.htm
MACRO LANGUAGE
ODS
http://support.sas.com/rnd/base/ods/scratch/ods-tips.pdf
ODS
http://support.sas.com/rnd/base/ods/scratch/ods-tips.pdf
Data Visualization using SAS
Data Visualization using SAS
Data Visualization using SAS
Data Visualization using SAS
Use Tasks
see https://welcomedata.wordpress.com/2015/03/23/quick-pie-charts-in-sas-university-edition/
Modeling using SAS
proc reg data=sashelp.cars;
model MPG_City = Cylinders Weight ;
run;
Modeling using SAS
proc reg data=sashelp.cars;
model MPG_City = Cylinders Weight ;
run;
Modeling using SAS
proc reg data=sashelp.cars;
model MPG_City = Cylinders Weight ;
run;
Modeling using SAS
proc reg data=sashelp.cars;
model MPG_City = Cylinders Weight ;
run;
Modeling using SAS
Try this
proc reg data=sashelp.iris;
model SepalLength = SepalWidth PetalLength PetalWidth ;
run;
NOW TRY THIS
proc reg data=sashelp.iris;
model SepalLength = SepalWidth PetalLength PetalWidth /vif collin;
run;
Modeling using SAS : Multicollinearity
http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.
htm#statug_reg_sect038.htm
Modeling using SAS : PROC LOGISTIC
proc logistic data=sashelp.Bmt;
class Group;
model Status=Group;
run;
Modeling using SAS : PROC LOGISTIC
proc logistic data=sashelp.
Bmt;
class Group;
model Status=Group;
run;
Questions or Feedback
Email us at
info@decisionstats.org
Introduction to SAS

More Related Content

PPTX
SAS - Statistical Analysis System
PDF
Sas cheat
PPTX
SAS basics Step by step learning
PPTX
Introduction to clinical sas programming
PDF
SAS cheat sheet
PPT
SAS BASICS
PPTX
Introduction to clinical sas
PPTX
Statistical software
SAS - Statistical Analysis System
Sas cheat
SAS basics Step by step learning
Introduction to clinical sas programming
SAS cheat sheet
SAS BASICS
Introduction to clinical sas
Statistical software

What's hot (20)

PDF
Basics of SAS
PPTX
Sas Statistical Analysis System
PPTX
R programming language
PPTX
Spss by vijay ambast
PDF
Introduction to SAS
PPTX
PPTX
Application of excel and spss programme in statistical
PPTX
Clinical trial design
PPT
Basics Of SAS Programming Language
PPTX
Introduction to statistical software R
DOCX
SAS Programming Notes
PPTX
PPTX
Epi Info- An Statistical Software
PPTX
Applications of sas and minitab in data analysis
PPTX
PPT
SAS Macros
PPT
CDISC SDTM Domain Presentation
PPTX
Minitab- A statistical tool
PPTX
Clinical study designs
Basics of SAS
Sas Statistical Analysis System
R programming language
Spss by vijay ambast
Introduction to SAS
Application of excel and spss programme in statistical
Clinical trial design
Basics Of SAS Programming Language
Introduction to statistical software R
SAS Programming Notes
Epi Info- An Statistical Software
Applications of sas and minitab in data analysis
SAS Macros
CDISC SDTM Domain Presentation
Minitab- A statistical tool
Clinical study designs
Ad

Viewers also liked (10)

PPTX
Presentation1
PDF
FLOW3 Experience 2012 - Keynote
PPTX
U23000754 data mining final project
PPT
Improving Effeciency with Options in SAS
PDF
SAS Analytics In Action - The New BI
PPTX
What is the Value of SAS Analytics?
PPTX
Rapid Miner: Data Transformation
PPTX
Demand forecasting by time series analysis
PDF
Statistics for data scientists
PPTX
Time Series
Presentation1
FLOW3 Experience 2012 - Keynote
U23000754 data mining final project
Improving Effeciency with Options in SAS
SAS Analytics In Action - The New BI
What is the Value of SAS Analytics?
Rapid Miner: Data Transformation
Demand forecasting by time series analysis
Statistics for data scientists
Time Series
Ad

Similar to Introduction to sas (20)

PPTX
Introducción al Software Analítico SAS
PPT
BASE SAS Training presentation of coding
PPT
Sas classes in mumbai
PDF
Sas summary guide
PDF
I need help with Applied Statistics and the SAS Programming Language.pdf
DOC
Sas basis imp intrw ques
PPT
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
DOC
Introduction to SAS
PPT
Sas-training-in-mumbai
PPTX
BAS 150 Lesson 3 Lecture
PPT
Prog1 chap1 and chap 2
PDF
SAS Internal Training
PPTX
SAS Mainframe -Program-Tips
PPT
Sas short course_presentation_11-4-09
PPT
Sas short course_presentation_11-4-09
PPTX
BAS 150 Lesson 7 Lecture
PPTX
BAS 150 Lesson 4 Lecture
PPT
INTRODUCTION TO SAS
DOCX
Base sas interview questions
Introducción al Software Analítico SAS
BASE SAS Training presentation of coding
Sas classes in mumbai
Sas summary guide
I need help with Applied Statistics and the SAS Programming Language.pdf
Sas basis imp intrw ques
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
Introduction to SAS
Sas-training-in-mumbai
BAS 150 Lesson 3 Lecture
Prog1 chap1 and chap 2
SAS Internal Training
SAS Mainframe -Program-Tips
Sas short course_presentation_11-4-09
Sas short course_presentation_11-4-09
BAS 150 Lesson 7 Lecture
BAS 150 Lesson 4 Lecture
INTRODUCTION TO SAS
Base sas interview questions

More from Ajay Ohri (20)

PDF
Introduction to R ajay Ohri
PPTX
Introduction to R
PDF
Social Media and Fake News in the 2016 Election
PDF
Pyspark
PDF
Download Python for R Users pdf for free
PDF
Install spark on_windows10
DOCX
Ajay ohri Resume
PPTX
National seminar on emergence of internet of things (io t) trends and challe...
PDF
Tools and techniques for data science
PPTX
How Big Data ,Cloud Computing ,Data Science can help business
PDF
Training in Analytics and Data Science
PDF
Tradecraft
PDF
Software Testing for Data Scientists
PDF
Craps
PDF
A Data Science Tutorial in Python
PDF
How does cryptography work? by Jeroen Ooms
PDF
Using R for Social Media and Sports Analytics
PDF
Kush stats alpha
PPTX
Analyze this
PPTX
Summer school python in spanish
Introduction to R ajay Ohri
Introduction to R
Social Media and Fake News in the 2016 Election
Pyspark
Download Python for R Users pdf for free
Install spark on_windows10
Ajay ohri Resume
National seminar on emergence of internet of things (io t) trends and challe...
Tools and techniques for data science
How Big Data ,Cloud Computing ,Data Science can help business
Training in Analytics and Data Science
Tradecraft
Software Testing for Data Scientists
Craps
A Data Science Tutorial in Python
How does cryptography work? by Jeroen Ooms
Using R for Social Media and Sports Analytics
Kush stats alpha
Analyze this
Summer school python in spanish

Recently uploaded (20)

PDF
2025-08 San Francisco FinOps Meetup: Tiering, Intelligently.
PDF
PPT nikita containers of the company use
PDF
Nucleic-Acids_-Structure-Typ...-1.pdf 011
PPTX
Basic Statistical Analysis for experimental data.pptx
PDF
9 FinOps Tools That Simplify Cloud Cost Reporting.pdf
PDF
Grey Minimalist Professional Project Presentation (1).pdf
PPTX
9 Bioterrorism.pptxnsbhsjdgdhdvkdbebrkndbd
PPTX
AI-Augmented Business Process Management Systems
PPTX
cyber row.pptx for cyber proffesionals and hackers
PPTX
transformers as a tool for understanding advance algorithms in deep learning
PDF
Buddhism presentation about world religion
PDF
Book Trusted Companions in Delhi – 24/7 Available Delhi Personal Meeting Ser...
PDF
Delhi c@ll girl# cute girls in delhi with travel girls in delhi call now
PDF
toaz.info-grade-11-2nd-quarter-earth-and-life-science-pr_5360bfd5a497b75f7ae4...
PPTX
DAA UNIT 1 for unit 1 time compixity PPT.pptx
PPTX
DATA ANALYTICS COURSE IN PITAMPURA.pptx
PPTX
Overview_of_Computing_Presentation.pptxxx
PPTX
research framework and review of related literature chapter 2
PPT
Technicalities in writing workshops indigenous language
PPTX
Capstone Presentation a.pptx on data sci
2025-08 San Francisco FinOps Meetup: Tiering, Intelligently.
PPT nikita containers of the company use
Nucleic-Acids_-Structure-Typ...-1.pdf 011
Basic Statistical Analysis for experimental data.pptx
9 FinOps Tools That Simplify Cloud Cost Reporting.pdf
Grey Minimalist Professional Project Presentation (1).pdf
9 Bioterrorism.pptxnsbhsjdgdhdvkdbebrkndbd
AI-Augmented Business Process Management Systems
cyber row.pptx for cyber proffesionals and hackers
transformers as a tool for understanding advance algorithms in deep learning
Buddhism presentation about world religion
Book Trusted Companions in Delhi – 24/7 Available Delhi Personal Meeting Ser...
Delhi c@ll girl# cute girls in delhi with travel girls in delhi call now
toaz.info-grade-11-2nd-quarter-earth-and-life-science-pr_5360bfd5a497b75f7ae4...
DAA UNIT 1 for unit 1 time compixity PPT.pptx
DATA ANALYTICS COURSE IN PITAMPURA.pptx
Overview_of_Computing_Presentation.pptxxx
research framework and review of related literature chapter 2
Technicalities in writing workshops indigenous language
Capstone Presentation a.pptx on data sci

Introduction to sas

  • 3. What is SAS? • SAS (Statistical Analysis System • Software suite developed by SAS Institute for advanced analytics, business intelligence, data management, and predictive analytics • Developed at North Carolina State University from 1966 until 1976, when SAS Institute was incorporated. • Further developed in the 1980s and 1990s with the additional statistical procedures and components
  • 4. Components of SAS Currently, SAS has more than 200 components, some of them are – • Base SAS – Basic procedures and data management • SAS/STAT – Statistical analysis • SAS/GRAPH – Graphics and presentation • SAS/OR – Operations research • SAS/ETS – Econometrics and Time Series Analysis • SAS/IML – Interactive matrix language
  • 6. SAS Interface • Code Editor where we write and modify mode • Log is a record of everything that we do in SAS session or SAS program :- – Program statements identified by line numbers – Messages that begin with NOTE, INFO, WARNING, ERROR, or an error number – Process time • Result displays printed output
  • 10. SAS Explorer • All libraries, folders , files that include data, saved code and saved output can be found here
  • 11. SAS Language • SAS program consists of SAS Statements • Each SAS Statement end with a semi-colon (;) • Basic SAS Statements are : – Data Step – Proc Step DATA Step – used to create or modify data sets PROC Step (Procedure) - pre-written rules that analyze and process data in a SAS dataset and then produce a report
  • 12. SAS Language • A SAS program can consist of a DATA step or a PROC step or any combination of DATA and PROC steps. • Data Step and Proc Step are followed by Run Statement. • SAS statements are free-format – – they can begin and end anywhere on a line – one statement can continue over several lines • To Comment use (/*Comment*/)
  • 13. Class Assignment Create a cheat sheet for yourself of the code that you run in the class. Add short comments for each program or each new step. Submit the cheat sheet at the end of the class.
  • 14. Create Temporary Data set i. There are six SAS statements. ii. DATA step – creates a new dataset called first. iii. PROC step – prints/displays that dataset in the results/output window.
  • 15. PROC Step • Proc PRINT • Proc DATASETS • Proc CONTENTS • Proc SORT • Proc FREQ • Proc MEANS • Proc UNIVARIATE • Proc CORR
  • 16. Create Temporary Data set • Input Statement – – Input variable names, – Describes arrangement of values in the input data record and assigns • Datalines/Cards Statement indicates that existence of data lines below In the above program: i. There are seven SAS statements; ii. The INPUT statement defines the variables to be read in each line of data. iii. The DATALINES statement indicates to SAS that DATA step statements are completed and the next line contains real data. iv. Notice that the lines of data do not end in a semicolon.
  • 17. Create Temporary Data set Missing values for Character variable o? Let us check Log for errors
  • 18. Create Temporary Data set For character variable add “$” after variable name in Input statement
  • 19. SAS Options Here, PROC step prints only the first 4 observation s of the data set third
  • 20. SAS Options Here, PROC step prints the data set third beginning with observation 2 till observation 4
  • 21. SAS Libraries Permanent Libraries (Default) – • SASHELP – contains sample data sets • SASUSER – stores personal files Temporary Library – WORK – stores files only for current session
  • 22. SAS Files Rules for data set names – • i. 1 to 32 characters • ii. must begin with an alphabet A-Z(uppercase or lowercase) or underscore • ii. can continue with any combination of alphabets, numbers or underscores Referencing SAS Files • Two-Level Names • To reference a permanent SAS data set in your SAS programs, we use a two-level name • library name and the filename, or data set name: • libref.filename
  • 23. PROC Datasets PROC DATASETS is used • to list, copy, remove, or delete SAS files. • to change variable information such as name, format, informat and label. PROC Datasets does not require RUN Statement
  • 24. PROC Datasets The SAS log gives the name of all SAS datasets in the library called SASHELP
  • 25. PROC Datasets – CHANGE Statement In the following program, we change the name of dataset first to one using CHANGE Statement.
  • 26. PROC Datasets – DELETE Statement In the following program, we delete dataset one using DELETE Statement.
  • 27. Create data set using existing datasetrun • Use SET Statement and create a temporary data set for use in current session from an existing data set • Print the new data set using PROC Print • Try and see what the following program will do
  • 28. PROC Print – TITLE As the name suggests, TITLE Statements adds Title while printing the output.
  • 29. PROC Print – SUM To generate Column totals use SUM Statement within PROC Step
  • 30. PROC Sort Here, PROC Sort is used to create a sorted dataset in ascending order according to team variable.
  • 31. Calculate Subtotals Here, we calculate and print Subtotals for nhits sorted by variable team.
  • 32. PROC Contents PROC Contents - • provides information for SAS datasets or libraries • it gives the name of the dataset or library, the location, when it was created, the host that created it, and the time of the last modification. • For datasets it also provides the number of observations in the dataset, and attributes for each variable
  • 33. PROC Contents The following program requests information for sashelp.baseball dataset using PROC Contents.
  • 34. PROC Freq PROC FREQ – • Counts the number (frequency) of occurrences of each variable(both character and numeric). • Gives statistics from the data • Produces one- way to n-way frequency and cross- tabulation tables. • Produces printed output by default. • Lists each variable value along with the frequencies and percentages.
  • 35. PROC Freq The following program demonstrates the simplest form of PROC FREQ and produces the output The output of this program is too long for our purpose to include here. Add TABLES Statement to limit the output for only one variable and create a one-way frequency table
  • 36. PROC Freq Create two-way cross-tabulation tables : In the TABLES statement, state the variable names separated by asterisk
  • 37. PROC Means PROC MEANS – • produces statistics for numeric variables. • produces printed output by default • computes N, MEAN, STD, MIN and MAX by default • similar to PROC SUMMARY however, PROC SUMMARY does not produce a printed output by default.
  • 38. PROC Means The following shows simplest use of PROC MEANS procedure.
  • 39. PROC Means – VAR VAR statement – • selects specified variable , • Identifies the analysis variables and their order in the output.
  • 40. PROC Means – Statistic To obtain a specific statistic you must state it in the PROC MEANS statement.
  • 41. PROC Means – Class • The CLASS statement assigns variables used to form subgroups. • CLASS variables can be either numeric or character.
  • 42. PROC Means – Output Output Statement stores result in new data set. Here, the new data set is baseball_new.
  • 43. PROC Univariate PROC UNIVARIATE • Examines distribution for numeric variables. • produces printed output by default The following shows simplest use of PROC Univariate procedure.
  • 44. PROC Univariate – NORMAL NORMAL Option requests for tests for normality that include a series of goodness-of-fit tests based on the empirical distribution function.
  • 45. PROC Univariate – PLOT PLOT Option in PROC Univariate produces a stem- and-leaf plot (or a horizontal bar chart), a box plot, and a normal quantile plot
  • 48. Incrementing Loop Here the i is being incremented by 2 in the loop
  • 49. Dropping Variable Here, we create a dataset Sixth. We run a loop using a new variable i, but drop it so that it does not include in the dataset.
  • 50. Decrementing Loop Here the i is being decremented by 2 in the loop
  • 51. Dataset using Raw file 1. Create a new folder in myfolders and call it mine. 2. Use libname statement to create a new SAS library called mine. How do we get the path of mine?
  • 52. Dataset using Raw file 3. Upload diamonds.csv dataset into the mine folder 4. Check the folder
  • 53. PROC Import We use Proc IMPORT to import the dataset. • OUT Option specifies a name for SAS data set • DATAFILE Statement specifies the location/path of the uploaded file. • DBMS Statement indicates the type of uploaded file. • GETNAMES Statement tells SAS whether the first row of the data values is to be considered as variable names or not(Yes - if to be considered as variable names).
  • 54. Dataset using Raw file Check the MINE Library Create a temporary data set called diamonds, using the existing data set.
  • 55. PROC Corr Correlation is one of the first steps to understand the relationship between variables. To compute correlation in SAS, we use PROC CORR. Corr Procedure calculates pairwise correlation for Numeric variables. This procedure also provides some summary statistics by default - Mean, Standard Deviation, Sum, Minimum and Maximum.
  • 56. Assignment Make use of the procedures learnt in the class to compute statistics for diamonds data set. https://vincentarelbundock.github.io/Rdatasets/csv/Ecdat/Diamond.csv
  • 57. SAS DOCUMENTATION = Hallelujah! http://support.sas.com/documentation/
  • 67. Data Visualization using SAS Use Tasks see https://welcomedata.wordpress.com/2015/03/23/quick-pie-charts-in-sas-university-edition/
  • 68. Modeling using SAS proc reg data=sashelp.cars; model MPG_City = Cylinders Weight ; run;
  • 69. Modeling using SAS proc reg data=sashelp.cars; model MPG_City = Cylinders Weight ; run;
  • 70. Modeling using SAS proc reg data=sashelp.cars; model MPG_City = Cylinders Weight ; run;
  • 71. Modeling using SAS proc reg data=sashelp.cars; model MPG_City = Cylinders Weight ; run;
  • 72. Modeling using SAS Try this proc reg data=sashelp.iris; model SepalLength = SepalWidth PetalLength PetalWidth ; run; NOW TRY THIS proc reg data=sashelp.iris; model SepalLength = SepalWidth PetalLength PetalWidth /vif collin; run;
  • 73. Modeling using SAS : Multicollinearity http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer. htm#statug_reg_sect038.htm
  • 74. Modeling using SAS : PROC LOGISTIC proc logistic data=sashelp.Bmt; class Group; model Status=Group; run;
  • 75. Modeling using SAS : PROC LOGISTIC proc logistic data=sashelp. Bmt; class Group; model Status=Group; run;