SlideShare una empresa de Scribd logo
1 de 53
StatiStical
analySiS Software
Luckshay Batra
luckybatra17@gmail.com
The power to know
Overview – Why SAS
Can handle upto
65,000 records
Can handle upto
1 mio. records
How can we over come
these limitations ?
How can we over come
these limitations ?
Can handle millions &
billions of records
Few modules in SAS
Base SAS
SAS STAT
SAS QC
SAS OR
SAS E-miner
SAS ETS
SAS AF….
DATA steps are typically used to create
SAS data sets.
PROC steps are typically used to process
SAS data sets (that is, generate reports
and graphs, edit data, and sort data).
A SAS program is a sequence of steps that the user
submits for execution.
Raw
Data
Raw
Data
DATA
Step
DATA
Step ReportReport
SAS
Data
Set
SAS
Data
Set
PROC
Step
PROC
Step
Flowchart – SAS program
Basic differences between DATA and PROC
steps
DATA Steps
 Begin with DATA statements
 Read and modify data
 Create a SAS data set
PROC Steps
 Begin with PROC statements
 Perform specific analysis or function
 Produce results or report
data work.staff;
infile 'raw-data-file';
input LastName $ 1-20 FirstName $ 21-30
JobTitle $ 36-43 Salary 54-59;
run;
proc print data=work.staff;
run;
proc means data=work.staff;
class JobTitle;
var Salary;
run;
DATA
Step
PROC
Steps
Sample program
SAS steps begin with a
 DATA statement
 PROC statement
SAS detects the end of a step when it encounters
 a RUN statement (for most steps)
 a QUIT statement (for some procedures)
 the beginning of another step (DATA statement or
PROC statement)
Step Boundaries
data work.staff;
infile 'raw-data-file';
input LastName $ 1-20 FirstName $ 21-30
JobTitle $ 36-43 Salary 54-59;
run;
proc print data=work.staff; run;
proc means data=work.staff;
class JobTitle;
var Salary;
run;
Step Boundaries
Interactive windows enable you to interface with SAS.
SAS Windowing Environment
The SAS Windows
There are five basic SAS windows
Results – The results window is like a table of contents for your output
window; the results tree lists each part of your results in an outline form
Explorer – The explorer window gives you easy access to your SAS files
and libraries
Three programming windows
Editors
Log
Output
How to run SAS Program
Submit SAS program
We can submit a SAS program in 2 different ways
by using F3 function
by using submit button
When you execute a SAS program, the output generated
by SAS is divided into two major parts:
SAS log contains information about the processing of
the SAS program, including any warning and
error messages.
SAS output contains reports generated by SAS
procedures and DATA steps.
Submitting a SAS Program
1 data work.staff;
2 infile 'raw-data-file';
3 input LastName $ 1-20 FirstName $ 21-30
4 JobTitle $ 36-43 Salary 54-59;
5 run;
NOTE: The infile 'raw-data-file' is:
File Name= 'raw-data-file',
RECFM=V,LRECL=256
NOTE: 18 records were read from the infile 'raw-data-file'.
The minimum record length was 59.
The maximum record length was 59.
NOTE: The data set WORK.STAFF has 18 observations and 4 variables.
6 proc print data=work.staff;
7 run;
NOTE: There were 18 observations read from the dataset WORK.STAFF.
8 proc means data=work.staff;
9 class JobTitle;
10 var Salary;
11 run;
NOTE: There were 18 observations read from the dataset WORK.STAFF.
SAS Log
The SAS System
First
Obs LastName Name JobTitle Salary
1 TORRES JAN Pilot 50000
2 LANGKAMM SARAH Mechanic 80000
3 SMITH MICHAEL Mechanic 40000
4 LEISTNER COLIN Mechanic 36000
5 WADE KIRSTEN Pilot 85000
6 TOMAS HARALD Pilot 105000
7 WAUGH TIM Pilot 70000
8 LEHMANN DAGMAR Mechanic 64000
9 TRETTHAHN MICHAEL Pilot 100000
10 TIETZ OTTO Pilot 45000
11 O'DONOGHUE ART Mechanic 52000
12 WALKER THOMAS Pilot 95000
13 NOROVIITA JOACHIM Mechanic 78000
14 OESTERBERG ANJA Mechanic 80000
15 LAUFFER CRAIG Mechanic 40000
16 TORR JUGDISH Pilot 45000
17 WAGSCHAL NADJA Pilot 77500
18 TOERMOEN JOCHEN Pilot 65000
SAS Output
Fundamental Concepts
 Define a SAS variable
 Identify a missing value and a SAS date value
 State the naming conventions for SAS data sets and
variables
 Explain SAS syntax rules
 Investigate a SAS data set using the CONTENTS and
PRINT procedures
Objectives
SAS Data Sets
SAS
Data Set
Descriptor
Portion
Data
Portion
General data set information
* data set name * data set label
* date/time created * storage information
* number of observations
Information for each variable
* Name * Type * Length
* Format * Informat * Label
SAS Data Sets: Descriptor Portion
The descriptor portion of a SAS data set contains
 general information about the SAS data set
 variable attributes
The CONTENTS procedure displays the descriptor portion of a SAS data set.
Descriptor Portion:
General form of the CONTENTS procedure:
Example:
PROC CONTENTS DATA=SAS-data-set;
RUN;
PROC CONTENTS DATA=SAS-data-set;
RUN;
proc contents data=work.staff;
run;
Browsing the Descriptor Portion
The SAS System
The CONTENTS Procedure
Data Set Name: WORK.STAFF Observations: 18
Member Type: DATA Variables: 4
Engine: V8 Indexes: 0
Created: 18:09 Sunday, Observation Length: 48
July 22, 2001
Last Modified: 18:09 Sunday, Deleted Observations: 0
July 22, 2001
Protection: Compressed: NO
Data Set Type: Sorted: NO
Label:
-----Alphabetic List of Variables and Attributes-----
# Variable Type Len
2 FirstName Char 10
3 JobTitle Char 8
1 LastName Char 20
4 Salary Num 8
PROC CONTENTS Output
Numeric
values
Variable
names
Variable
values
LastName FirstName JobTitle Salary
TORRES JAN Pilot 50000
LANGKAMM SARAH Mechanic 80000
SMITH MICHAEL Mechanic 40000
WAGSCHAL NADJA Pilot 77500
TOERMOEN JOCHEN Pilot 65000
The data portion of a SAS data set is a rectangular table
of character and/or numeric data values.
Character values
SAS Data Sets: Data Portion
The PRINT procedure displays the data portion of a
SAS data set.
By default, PROC PRINT displays
 all observations
 all variables
 an Obs column on the left side
Browsing the Data Portion
General form of the PRINT procedure:
Example:
PROC PRINT DATA=SAS-data-set;
RUN;
PROC PRINT DATA=SAS-data-set;
RUN;
proc print data=work.staff;
run;
Browsing the Data Portion
The SAS System
First
Obs LastName Name JobTitle Salary
1 TORRES JAN Pilot 50000
2 LANGKAMM SARAH Mechanic 80000
3 SMITH MICHAEL Mechanic 40000
4 LEISTNER COLIN Mechanic 36000
5 WADE KIRSTEN Pilot 85000
6 TOMAS HARALD Pilot 105000
7 WAUGH TIM Pilot 70000
8 LEHMANN DAGMAR Mechanic 64000
9 TRETTHAHN MICHAEL Pilot 100000
10 TIETZ OTTO Pilot 45000
11 O'DONOGHUE ART Mechanic 52000
12 WALKER THOMAS Pilot 95000
13 NOROVIITA JOACHIM Mechanic 78000
14 OESTERBERG ANJA Mechanic 80000
15 LAUFFER CRAIG Mechanic 40000
16 TORR JUGDISH Pilot 45000
17 WAGSCHAL NADJA Pilot 77500
18 TOERMOEN JOCHEN Pilot 65000
PROC PRINT Output
SAS names
 can be 32 characters long
 can be uppercase, lowercase, or mixed-case
 must start with a letter or underscore. Subsequent
characters can be letters, underscores, or numeric
digits.
Data Set Names and Variable Names
SAS Variable Values
There are two types of variables:
character contain any value: letters, numbers, special
characters, and blanks. Character values are
stored with a length of 1 to 32,767 bytes. One
byte equals one character.
numeric stored as floating point numbers in 8 bytes
of storage by default. Eight bytes of floating point
storage provide space for 16 or 17 significant
digits. You are not restricted to 8 digits.
Select the default valid SAS names.
 data5mon
 5monthsdata
 five months data
 fivemonthsdata
 data#5
Valid SAS Names
 fivemonthsdata
 data5mon
Select the default valid SAS names.
 data5mon
 5monthsdata
 five months data
 fivemonthsdata
 data#5
Valid SAS Names
SAS stores date values as numeric values.
A SAS date value is stored as the number of days between
January 1, 1960, and a specific date.
01JAN1959 01JAN1960 01JAN1961
store
-365 0 366
display
01/01/1959 01/01/1960 01/01/1961
SAS Date Values
LastName FirstName JobTitle Salary
TORRES JAN Pilot 50000
LANGKAMM SARAH Mechanic 80000
SMITH MICHAEL Mechanic .
WAGSCHAL NADJA Pilot 77500
TOERMOEN JOCHEN 65000
A value must exist for every variable for each observation.
Missing values are valid values.
A numeric
missing value
is displayed as
a period.
A character missing
value is displayed as
a blank.
Missing Data Values
SAS documentation and text in the SAS windowing
environment use the following terms interchangeably:
SAS Data SetSAS Data Set SAS TableSAS Table
VariableVariable ColumnColumn
ObservationObservation RowRow
SAS Data Set Terminology
SAS statements
 usually begin with a keyword
 always end with a semicolon
data work.staff;
infile 'raw-data-file';
input LastName $ 1-20 FirstName $ 21-30
JobTitle $ 36-43 Salary 54-59;
run;
proc print data=work.staff;
run;
proc means data=work.staff;
class JobTitle;
var Salary;
run;
SAS Syntax Rules
 SAS statements are free-format
 One or more blanks or special characters can be
used to separate words
 SAS statements can begin and end in any column
 A single statement can span multiple lines
 Several statements can be on the same line
Unconventional Spacing
...
data work.staff;
infile 'raw-data-file';
input LastName $ 1-20 FirstName $ 21-30
JobTitle $ 36-43 Salary 54-59;
run;
proc means data=work.staff;
class JobTitle; var Salary;run;
SAS Syntax Rules
 SAS statements are free-format
 One or more blanks or special characters can be
used to separate words
 SAS statements can begin and end in any column
 A single statement can span multiple lines
 Several statements can be on the same line
Unconventional Spacing
...
data work.staff;
infile 'raw-data-file';
input LastName $ 1-20 FirstName $ 21-30
JobTitle $ 36-43 Salary 54-59;
run;
proc means data=work.staff;
class JobTitle; var Salary;run;
SAS Syntax Rules
data work.staff;
infile 'raw-data-file';
input LastName $ 1-20 FirstName $ 21-30
JobTitle $ 36-43 Salary 54-59;
run;
proc means data=work.staff;
class JobTitle; var Salary;run;
 SAS statements are free-format
 One or more blanks or special characters can be
used to separate words
 SAS statements can begin and end in any column
 A single statement can span multiple lines
 Several statements can be on the same line
Unconventional Spacing
SAS Syntax Rules
 SAS statements are free-format
 One or more blanks or special characters can be
used to separate words
 SAS statements can begin and end in any column
 A single statement can span multiple lines
 Several statements can be on the same line
Unconventional Spacing
...
data work.staff;
infile 'raw-data-file';
input LastName $ 1-20 FirstName $ 21-30
JobTitle $ 36-43 Salary 54-59;
run;
proc means data=work.staff;
class JobTitle; var Salary;run;
SAS Syntax Rules
data work.staff;
infile 'raw-data-file';
input LastName $ 1-20 FirstName $ 21-30
JobTitle $ 36-43 Salary 54-59;
run;
proc means data=work.staff;
class JobTitle; var Salary;run;
...
 SAS statements are free-format
 One or more blanks or special characters can be
used to separate words
 SAS statements can begin and end in any column
 A single statement can span multiple lines
 Several statements can be on the same line
Unconventional Spacing
SAS Syntax Rules
data work.staff;
infile 'raw-data-file';
input LastName $ 1-20 FirstName $ 21-30
JobTitle $ 36-43 Salary 54-59;
run;
proc means data=work.staff;
class JobTitle; var Salary;run;
...
 SAS statements are free-format
 SAS statements can begin and end in any column
 One or more blanks or special characters can be
used to separate words
 A single statement can span multiple lines
 Several statements can be on the same line
Unconventional Spacing
SAS Syntax Rules
Good spacing makes the program easier to read.
Conventional Spacing
data work.staff;
infile 'raw-data-file';
input LastName $ 1-20 FirstName $ 21-30
JobTitle $ 36-43 Salary 54-59;
run;
proc print data=work.staff;
run;
proc means data=work.staff;
class JobTitle;
var Salary;
run;
SAS Syntax Rules
 Type /* to begin a comment
 Type your comment text
 Type */ to end the comment
/* Create work.staff data set */
data work.staff;
infile 'raw-data-file';
input LastName $ 1-20 FirstName $ 21-30
JobTitle $ 36-43 Salary 54-59;
run;
/* Produce listing report of work.staff */
proc print data=work.staff;
run;
SAS Comments
SAS Data Libraries
FILES
LIBRARIES
You can think of a SAS data library as a drawer in a
filing cabinet and a SAS data set as one of the files in
the drawer.
SAS Data Libraries
work
sasuser
ia
work - temporary library
sasuser - permanent library
When you invoke SAS, you automatically have
access to a temporary and a permanent SAS data
library.
You can create and access your own permanent libraries.
ia - permanent library
SAS Data Libraries
LIBNAME libref 'SAS-data-library’;LIBNAME libref 'SAS-data-library’;
Rules for naming a libref:
 must be 8 characters or less
 must begin with a letter or underscore
 remaining characters are letters, numbers, or
underscores
Assigning a Libref
■ You can use the LIBNAME statement to assign a libref
to a SAS data library
■ General form of the LIBNAME statement:
■ When you submit the LIBNAME statement, a connection is made
between a libref in SAS and the physical location of files on your
operating system
Making the Connection
Assigning a Libref
libname ia 'C:Documents and Settingsam502365Desktopprog1';
Physical location
 The first name (libref)
refers to the library
Every SAS file has a two-level name:
 The second name
(filename) refers to the
file in the library
The data set ia.sales is a SAS file in the ia library
libref.filename
sasuser
work
ia
sales
Two-level SAS Filenames
During an interactive SAS session, the LIBNAME window
enables you to investigate the contents of a SAS data library.
In the LIBNAME window, you can
 view a list of all the libraries available during your current
SAS session
 drill down to see all members of a specific library
SAS Data Library
LIBNAME Window: Windows
To explore the descriptor portion of a SAS data set,
specify the data set name in the DATA= option.
PROC CONTENTS DATA=libref.SAS-data-set-name;
RUN;
PROC CONTENTS DATA=libref.SAS-data-set-name;
RUN;
proc contents data=ia.crew;
run;
Browsing a SAS Data Library
The SAS System
The CONTENTS Procedure
Data Set Name: IA.CREW Observations: 69
Member Type: DATA Variables: 8
Engine: V8 Indexes: 0
Created: 15:15 Friday, Observation Length: 120
June 29, 2001
Last Modified: 15:41 Friday, Deleted Observations: 0
June 29, 2001
Protection: Compressed: NO
Data Set Type: Sorted: NO
Label:
-----Engine/Host Dependent Information-----
Data Set Page Size: 12288
Number of Data Set Pages: 1
First Data Page: 1
Max Obs per Page: 102
Obs in First Data Page: 69
Number of Data Set Repairs: 0
File Name: C:workshopwinsas
prog1crew.sas7bdat
Release Created: 8.0202M0
Host Created: WIN_PRO
PROC CONTENTS Output – Part 1
-----Alphabetic List of Variables and Attributes-----
# Variable Type Len Format Informat
6 EmpID Char 6
3 FirstName Char 32
1 HireDate Num 8 DATE9. DATE9.
7 JobCode Char 6
2 LastName Char 32
4 Location Char 16
5 Phone Char 8
8 Salary Num 8
PROC CONTENTS Output – Part 2
Exploring Your SAS Environment (Self-Study)

Más contenido relacionado

La actualidad más candente

Sas Statistical Analysis System
Sas Statistical Analysis SystemSas Statistical Analysis System
Sas Statistical Analysis SystemSushil kasar
 
CDISC SDTM Domain Presentation
CDISC SDTM Domain PresentationCDISC SDTM Domain Presentation
CDISC SDTM Domain PresentationAnkur Sharma
 
SDTM - Adverse Events Vs. Clinical Events
SDTM - Adverse Events Vs. Clinical EventsSDTM - Adverse Events Vs. Clinical Events
SDTM - Adverse Events Vs. Clinical EventsVijayaraghava Karpurapu
 
SAS Clinical Online Training
SAS Clinical Online TrainingSAS Clinical Online Training
SAS Clinical Online TrainingManga SubbuNaidu
 
Data Match Merging in SAS
Data Match Merging in SASData Match Merging in SAS
Data Match Merging in SASguest2160992
 
Introduction to SAS Data Set Options
Introduction to SAS Data Set OptionsIntroduction to SAS Data Set Options
Introduction to SAS Data Set OptionsMark Tabladillo
 
SAS Programming For Beginners | SAS Programming Tutorial | SAS Tutorial | SAS...
SAS Programming For Beginners | SAS Programming Tutorial | SAS Tutorial | SAS...SAS Programming For Beginners | SAS Programming Tutorial | SAS Tutorial | SAS...
SAS Programming For Beginners | SAS Programming Tutorial | SAS Tutorial | SAS...Edureka!
 
Cdisc sdtm implementation_process _v1
Cdisc sdtm implementation_process _v1Cdisc sdtm implementation_process _v1
Cdisc sdtm implementation_process _v1ray4hz
 
SAS cheat sheet
SAS cheat sheetSAS cheat sheet
SAS cheat sheetAli Ajouz
 
SDTM (Study Data Tabulation Model)
SDTM (Study Data Tabulation Model)SDTM (Study Data Tabulation Model)
SDTM (Study Data Tabulation Model)SWAROOP KUMAR K
 
Learn SAS Programming
Learn SAS ProgrammingLearn SAS Programming
Learn SAS ProgrammingSASTechies
 

La actualidad más candente (20)

Sas Statistical Analysis System
Sas Statistical Analysis SystemSas Statistical Analysis System
Sas Statistical Analysis System
 
Introduction to clinical sas
Introduction to clinical sasIntroduction to clinical sas
Introduction to clinical sas
 
SAS basics Step by step learning
SAS basics Step by step learningSAS basics Step by step learning
SAS basics Step by step learning
 
SAS Functions
SAS FunctionsSAS Functions
SAS Functions
 
Sas demo
Sas demoSas demo
Sas demo
 
SAS Proc SQL
SAS Proc SQLSAS Proc SQL
SAS Proc SQL
 
SAS Programming Notes
SAS Programming NotesSAS Programming Notes
SAS Programming Notes
 
CDISC SDTM Domain Presentation
CDISC SDTM Domain PresentationCDISC SDTM Domain Presentation
CDISC SDTM Domain Presentation
 
Sas Presentation
Sas PresentationSas Presentation
Sas Presentation
 
SDTM - Adverse Events Vs. Clinical Events
SDTM - Adverse Events Vs. Clinical EventsSDTM - Adverse Events Vs. Clinical Events
SDTM - Adverse Events Vs. Clinical Events
 
SAS Clinical Online Training
SAS Clinical Online TrainingSAS Clinical Online Training
SAS Clinical Online Training
 
Data Match Merging in SAS
Data Match Merging in SASData Match Merging in SAS
Data Match Merging in SAS
 
Introduction to SAS Data Set Options
Introduction to SAS Data Set OptionsIntroduction to SAS Data Set Options
Introduction to SAS Data Set Options
 
SAS Macros
SAS MacrosSAS Macros
SAS Macros
 
SAS Programming For Beginners | SAS Programming Tutorial | SAS Tutorial | SAS...
SAS Programming For Beginners | SAS Programming Tutorial | SAS Tutorial | SAS...SAS Programming For Beginners | SAS Programming Tutorial | SAS Tutorial | SAS...
SAS Programming For Beginners | SAS Programming Tutorial | SAS Tutorial | SAS...
 
Cdisc sdtm implementation_process _v1
Cdisc sdtm implementation_process _v1Cdisc sdtm implementation_process _v1
Cdisc sdtm implementation_process _v1
 
SAS cheat sheet
SAS cheat sheetSAS cheat sheet
SAS cheat sheet
 
SDTM Fnal Detail Training
SDTM Fnal Detail TrainingSDTM Fnal Detail Training
SDTM Fnal Detail Training
 
SDTM (Study Data Tabulation Model)
SDTM (Study Data Tabulation Model)SDTM (Study Data Tabulation Model)
SDTM (Study Data Tabulation Model)
 
Learn SAS Programming
Learn SAS ProgrammingLearn SAS Programming
Learn SAS Programming
 

Destacado

Jose alfredo basilio sanchez boletinomaped
Jose alfredo basilio sanchez  boletinomapedJose alfredo basilio sanchez  boletinomaped
Jose alfredo basilio sanchez boletinomapedJose Basilio Sanchez
 
Multivariate Data Analysis
Multivariate Data AnalysisMultivariate Data Analysis
Multivariate Data AnalysisMerul Romadhani
 
probability sampling
probability samplingprobability sampling
probability samplingRoshni Kapoor
 
Sample size calculation
Sample  size calculationSample  size calculation
Sample size calculationSwati Singh
 
Understanding SAS Data Step Processing
Understanding SAS Data Step ProcessingUnderstanding SAS Data Step Processing
Understanding SAS Data Step Processingguest2160992
 
Multivariate Analysis An Overview
Multivariate Analysis An OverviewMultivariate Analysis An Overview
Multivariate Analysis An Overviewguest3311ed
 
Multivariate Analysis Techniques
Multivariate Analysis TechniquesMultivariate Analysis Techniques
Multivariate Analysis TechniquesMehul Gondaliya
 
Sample size
Sample sizeSample size
Sample sizezubis
 

Destacado (11)

Jose alfredo basilio sanchez boletinomaped
Jose alfredo basilio sanchez  boletinomapedJose alfredo basilio sanchez  boletinomaped
Jose alfredo basilio sanchez boletinomaped
 
Sample Size Determination
Sample Size Determination Sample Size Determination
Sample Size Determination
 
Multivariate Data Analysis
Multivariate Data AnalysisMultivariate Data Analysis
Multivariate Data Analysis
 
probability sampling
probability samplingprobability sampling
probability sampling
 
Sample size calculation
Sample  size calculationSample  size calculation
Sample size calculation
 
Understanding SAS Data Step Processing
Understanding SAS Data Step ProcessingUnderstanding SAS Data Step Processing
Understanding SAS Data Step Processing
 
Multivariate Analysis An Overview
Multivariate Analysis An OverviewMultivariate Analysis An Overview
Multivariate Analysis An Overview
 
Multivariate Analysis Techniques
Multivariate Analysis TechniquesMultivariate Analysis Techniques
Multivariate Analysis Techniques
 
Sample size
Sample sizeSample size
Sample size
 
sampling ppt
sampling pptsampling ppt
sampling ppt
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
 

Similar a Sas

Prog1 chap1 and chap 2
Prog1 chap1 and chap 2Prog1 chap1 and chap 2
Prog1 chap1 and chap 2rowensCap
 
Hechsp 001 Chapter 2
Hechsp 001 Chapter 2Hechsp 001 Chapter 2
Hechsp 001 Chapter 2Brian Kelly
 
Introduction To Sas
Introduction To SasIntroduction To Sas
Introduction To Sashalasti
 
SAS Mainframe -Program-Tips
SAS Mainframe -Program-TipsSAS Mainframe -Program-Tips
SAS Mainframe -Program-TipsSrinimf-Slides
 
Introduction to-sas-1211594349119006-8
Introduction to-sas-1211594349119006-8Introduction to-sas-1211594349119006-8
Introduction to-sas-1211594349119006-8thotakoti
 
Introduction to SAS
Introduction to SASIntroduction to SAS
Introduction to SASImam Jaffer
 
Sas Talk To R Users Group
Sas Talk To R Users GroupSas Talk To R Users Group
Sas Talk To R Users Groupgeorgette1200
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standardsAlessandro Baratella
 
Introducción al Software Analítico SAS
Introducción al Software Analítico SASIntroducción al Software Analítico SAS
Introducción al Software Analítico SASJorge Rodríguez M.
 
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 20088323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008untellectualism
 
Draft sas and r and sas (may, 2018 asa meeting)
Draft sas and r and sas (may, 2018 asa meeting)Draft sas and r and sas (may, 2018 asa meeting)
Draft sas and r and sas (may, 2018 asa meeting)Barry DeCicco
 
SQL Optimization With Trace Data And Dbms Xplan V6
SQL Optimization With Trace Data And Dbms Xplan V6SQL Optimization With Trace Data And Dbms Xplan V6
SQL Optimization With Trace Data And Dbms Xplan V6Mahesh Vallampati
 
BAS 150 Lesson 3 Lecture
BAS 150 Lesson 3 LectureBAS 150 Lesson 3 Lecture
BAS 150 Lesson 3 LectureWake Tech BAS
 
Sas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary ToolSas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary Toolsysseminar
 

Similar a Sas (20)

Prog1 chap1 and chap 2
Prog1 chap1 and chap 2Prog1 chap1 and chap 2
Prog1 chap1 and chap 2
 
SAS Internal Training
SAS Internal TrainingSAS Internal Training
SAS Internal Training
 
SAS - Training
SAS - Training SAS - Training
SAS - Training
 
Hechsp 001 Chapter 2
Hechsp 001 Chapter 2Hechsp 001 Chapter 2
Hechsp 001 Chapter 2
 
Introduction To Sas
Introduction To SasIntroduction To Sas
Introduction To Sas
 
SAS Mainframe -Program-Tips
SAS Mainframe -Program-TipsSAS Mainframe -Program-Tips
SAS Mainframe -Program-Tips
 
Sas classes in mumbai
Sas classes in mumbaiSas classes in mumbai
Sas classes in mumbai
 
Introduction to-sas-1211594349119006-8
Introduction to-sas-1211594349119006-8Introduction to-sas-1211594349119006-8
Introduction to-sas-1211594349119006-8
 
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
 
SAS Commands
SAS CommandsSAS Commands
SAS Commands
 
Introduction to SAS
Introduction to SASIntroduction to SAS
Introduction to SAS
 
Sas Talk To R Users Group
Sas Talk To R Users GroupSas Talk To R Users Group
Sas Talk To R Users Group
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standards
 
Introducción al Software Analítico SAS
Introducción al Software Analítico SASIntroducción al Software Analítico SAS
Introducción al Software Analítico SAS
 
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 20088323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008
 
Draft sas and r and sas (may, 2018 asa meeting)
Draft sas and r and sas (may, 2018 asa meeting)Draft sas and r and sas (may, 2018 asa meeting)
Draft sas and r and sas (may, 2018 asa meeting)
 
Mysql
MysqlMysql
Mysql
 
SQL Optimization With Trace Data And Dbms Xplan V6
SQL Optimization With Trace Data And Dbms Xplan V6SQL Optimization With Trace Data And Dbms Xplan V6
SQL Optimization With Trace Data And Dbms Xplan V6
 
BAS 150 Lesson 3 Lecture
BAS 150 Lesson 3 LectureBAS 150 Lesson 3 Lecture
BAS 150 Lesson 3 Lecture
 
Sas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary ToolSas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary Tool
 

Más de Luckshay Batra

Values and ethics in mathematics
Values and ethics in mathematicsValues and ethics in mathematics
Values and ethics in mathematicsLuckshay Batra
 
Motivation in Education
Motivation in EducationMotivation in Education
Motivation in EducationLuckshay Batra
 
R Programming language model test paper
R Programming language model test paperR Programming language model test paper
R Programming language model test paperLuckshay Batra
 
Mathematica model test paper
Mathematica model test paperMathematica model test paper
Mathematica model test paperLuckshay Batra
 
Matlab-Data types and operators
Matlab-Data types and operatorsMatlab-Data types and operators
Matlab-Data types and operatorsLuckshay Batra
 
Jacobi iterative method
Jacobi iterative methodJacobi iterative method
Jacobi iterative methodLuckshay Batra
 
Application of laplace wave equation in music
Application of laplace wave equation in musicApplication of laplace wave equation in music
Application of laplace wave equation in musicLuckshay Batra
 

Más de Luckshay Batra (12)

Values and ethics in mathematics
Values and ethics in mathematicsValues and ethics in mathematics
Values and ethics in mathematics
 
Motivation in Education
Motivation in EducationMotivation in Education
Motivation in Education
 
R Programming language model test paper
R Programming language model test paperR Programming language model test paper
R Programming language model test paper
 
Mathematica model test paper
Mathematica model test paperMathematica model test paper
Mathematica model test paper
 
Matlab-Data types and operators
Matlab-Data types and operatorsMatlab-Data types and operators
Matlab-Data types and operators
 
Black scholes model
Black scholes modelBlack scholes model
Black scholes model
 
Network flows
Network flowsNetwork flows
Network flows
 
Jacobi iterative method
Jacobi iterative methodJacobi iterative method
Jacobi iterative method
 
Markov chain
Markov chainMarkov chain
Markov chain
 
Cyclic group in music
Cyclic group in musicCyclic group in music
Cyclic group in music
 
Big m method
Big m methodBig m method
Big m method
 
Application of laplace wave equation in music
Application of laplace wave equation in musicApplication of laplace wave equation in music
Application of laplace wave equation in music
 

Último

RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改atducpo
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Delhi Call girls
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 

Último (20)

RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 

Sas

  • 2. Overview – Why SAS Can handle upto 65,000 records Can handle upto 1 mio. records How can we over come these limitations ? How can we over come these limitations ? Can handle millions & billions of records
  • 3. Few modules in SAS Base SAS SAS STAT SAS QC SAS OR SAS E-miner SAS ETS SAS AF….
  • 4. DATA steps are typically used to create SAS data sets. PROC steps are typically used to process SAS data sets (that is, generate reports and graphs, edit data, and sort data). A SAS program is a sequence of steps that the user submits for execution. Raw Data Raw Data DATA Step DATA Step ReportReport SAS Data Set SAS Data Set PROC Step PROC Step Flowchart – SAS program
  • 5. Basic differences between DATA and PROC steps DATA Steps  Begin with DATA statements  Read and modify data  Create a SAS data set PROC Steps  Begin with PROC statements  Perform specific analysis or function  Produce results or report
  • 6. data work.staff; infile 'raw-data-file'; input LastName $ 1-20 FirstName $ 21-30 JobTitle $ 36-43 Salary 54-59; run; proc print data=work.staff; run; proc means data=work.staff; class JobTitle; var Salary; run; DATA Step PROC Steps Sample program
  • 7. SAS steps begin with a  DATA statement  PROC statement SAS detects the end of a step when it encounters  a RUN statement (for most steps)  a QUIT statement (for some procedures)  the beginning of another step (DATA statement or PROC statement) Step Boundaries
  • 8. data work.staff; infile 'raw-data-file'; input LastName $ 1-20 FirstName $ 21-30 JobTitle $ 36-43 Salary 54-59; run; proc print data=work.staff; run; proc means data=work.staff; class JobTitle; var Salary; run; Step Boundaries
  • 9. Interactive windows enable you to interface with SAS. SAS Windowing Environment
  • 10. The SAS Windows There are five basic SAS windows Results – The results window is like a table of contents for your output window; the results tree lists each part of your results in an outline form Explorer – The explorer window gives you easy access to your SAS files and libraries Three programming windows Editors Log Output
  • 11. How to run SAS Program
  • 12. Submit SAS program We can submit a SAS program in 2 different ways by using F3 function by using submit button
  • 13. When you execute a SAS program, the output generated by SAS is divided into two major parts: SAS log contains information about the processing of the SAS program, including any warning and error messages. SAS output contains reports generated by SAS procedures and DATA steps. Submitting a SAS Program
  • 14. 1 data work.staff; 2 infile 'raw-data-file'; 3 input LastName $ 1-20 FirstName $ 21-30 4 JobTitle $ 36-43 Salary 54-59; 5 run; NOTE: The infile 'raw-data-file' is: File Name= 'raw-data-file', RECFM=V,LRECL=256 NOTE: 18 records were read from the infile 'raw-data-file'. The minimum record length was 59. The maximum record length was 59. NOTE: The data set WORK.STAFF has 18 observations and 4 variables. 6 proc print data=work.staff; 7 run; NOTE: There were 18 observations read from the dataset WORK.STAFF. 8 proc means data=work.staff; 9 class JobTitle; 10 var Salary; 11 run; NOTE: There were 18 observations read from the dataset WORK.STAFF. SAS Log
  • 15. The SAS System First Obs LastName Name JobTitle Salary 1 TORRES JAN Pilot 50000 2 LANGKAMM SARAH Mechanic 80000 3 SMITH MICHAEL Mechanic 40000 4 LEISTNER COLIN Mechanic 36000 5 WADE KIRSTEN Pilot 85000 6 TOMAS HARALD Pilot 105000 7 WAUGH TIM Pilot 70000 8 LEHMANN DAGMAR Mechanic 64000 9 TRETTHAHN MICHAEL Pilot 100000 10 TIETZ OTTO Pilot 45000 11 O'DONOGHUE ART Mechanic 52000 12 WALKER THOMAS Pilot 95000 13 NOROVIITA JOACHIM Mechanic 78000 14 OESTERBERG ANJA Mechanic 80000 15 LAUFFER CRAIG Mechanic 40000 16 TORR JUGDISH Pilot 45000 17 WAGSCHAL NADJA Pilot 77500 18 TOERMOEN JOCHEN Pilot 65000 SAS Output
  • 17.  Define a SAS variable  Identify a missing value and a SAS date value  State the naming conventions for SAS data sets and variables  Explain SAS syntax rules  Investigate a SAS data set using the CONTENTS and PRINT procedures Objectives
  • 18. SAS Data Sets SAS Data Set Descriptor Portion Data Portion
  • 19. General data set information * data set name * data set label * date/time created * storage information * number of observations Information for each variable * Name * Type * Length * Format * Informat * Label SAS Data Sets: Descriptor Portion The descriptor portion of a SAS data set contains  general information about the SAS data set  variable attributes The CONTENTS procedure displays the descriptor portion of a SAS data set. Descriptor Portion:
  • 20. General form of the CONTENTS procedure: Example: PROC CONTENTS DATA=SAS-data-set; RUN; PROC CONTENTS DATA=SAS-data-set; RUN; proc contents data=work.staff; run; Browsing the Descriptor Portion
  • 21. The SAS System The CONTENTS Procedure Data Set Name: WORK.STAFF Observations: 18 Member Type: DATA Variables: 4 Engine: V8 Indexes: 0 Created: 18:09 Sunday, Observation Length: 48 July 22, 2001 Last Modified: 18:09 Sunday, Deleted Observations: 0 July 22, 2001 Protection: Compressed: NO Data Set Type: Sorted: NO Label: -----Alphabetic List of Variables and Attributes----- # Variable Type Len 2 FirstName Char 10 3 JobTitle Char 8 1 LastName Char 20 4 Salary Num 8 PROC CONTENTS Output
  • 22. Numeric values Variable names Variable values LastName FirstName JobTitle Salary TORRES JAN Pilot 50000 LANGKAMM SARAH Mechanic 80000 SMITH MICHAEL Mechanic 40000 WAGSCHAL NADJA Pilot 77500 TOERMOEN JOCHEN Pilot 65000 The data portion of a SAS data set is a rectangular table of character and/or numeric data values. Character values SAS Data Sets: Data Portion
  • 23. The PRINT procedure displays the data portion of a SAS data set. By default, PROC PRINT displays  all observations  all variables  an Obs column on the left side Browsing the Data Portion
  • 24. General form of the PRINT procedure: Example: PROC PRINT DATA=SAS-data-set; RUN; PROC PRINT DATA=SAS-data-set; RUN; proc print data=work.staff; run; Browsing the Data Portion
  • 25. The SAS System First Obs LastName Name JobTitle Salary 1 TORRES JAN Pilot 50000 2 LANGKAMM SARAH Mechanic 80000 3 SMITH MICHAEL Mechanic 40000 4 LEISTNER COLIN Mechanic 36000 5 WADE KIRSTEN Pilot 85000 6 TOMAS HARALD Pilot 105000 7 WAUGH TIM Pilot 70000 8 LEHMANN DAGMAR Mechanic 64000 9 TRETTHAHN MICHAEL Pilot 100000 10 TIETZ OTTO Pilot 45000 11 O'DONOGHUE ART Mechanic 52000 12 WALKER THOMAS Pilot 95000 13 NOROVIITA JOACHIM Mechanic 78000 14 OESTERBERG ANJA Mechanic 80000 15 LAUFFER CRAIG Mechanic 40000 16 TORR JUGDISH Pilot 45000 17 WAGSCHAL NADJA Pilot 77500 18 TOERMOEN JOCHEN Pilot 65000 PROC PRINT Output
  • 26. SAS names  can be 32 characters long  can be uppercase, lowercase, or mixed-case  must start with a letter or underscore. Subsequent characters can be letters, underscores, or numeric digits. Data Set Names and Variable Names
  • 27. SAS Variable Values There are two types of variables: character contain any value: letters, numbers, special characters, and blanks. Character values are stored with a length of 1 to 32,767 bytes. One byte equals one character. numeric stored as floating point numbers in 8 bytes of storage by default. Eight bytes of floating point storage provide space for 16 or 17 significant digits. You are not restricted to 8 digits.
  • 28. Select the default valid SAS names.  data5mon  5monthsdata  five months data  fivemonthsdata  data#5 Valid SAS Names
  • 29.  fivemonthsdata  data5mon Select the default valid SAS names.  data5mon  5monthsdata  five months data  fivemonthsdata  data#5 Valid SAS Names
  • 30. SAS stores date values as numeric values. A SAS date value is stored as the number of days between January 1, 1960, and a specific date. 01JAN1959 01JAN1960 01JAN1961 store -365 0 366 display 01/01/1959 01/01/1960 01/01/1961 SAS Date Values
  • 31. LastName FirstName JobTitle Salary TORRES JAN Pilot 50000 LANGKAMM SARAH Mechanic 80000 SMITH MICHAEL Mechanic . WAGSCHAL NADJA Pilot 77500 TOERMOEN JOCHEN 65000 A value must exist for every variable for each observation. Missing values are valid values. A numeric missing value is displayed as a period. A character missing value is displayed as a blank. Missing Data Values
  • 32. SAS documentation and text in the SAS windowing environment use the following terms interchangeably: SAS Data SetSAS Data Set SAS TableSAS Table VariableVariable ColumnColumn ObservationObservation RowRow SAS Data Set Terminology
  • 33. SAS statements  usually begin with a keyword  always end with a semicolon data work.staff; infile 'raw-data-file'; input LastName $ 1-20 FirstName $ 21-30 JobTitle $ 36-43 Salary 54-59; run; proc print data=work.staff; run; proc means data=work.staff; class JobTitle; var Salary; run; SAS Syntax Rules
  • 34.  SAS statements are free-format  One or more blanks or special characters can be used to separate words  SAS statements can begin and end in any column  A single statement can span multiple lines  Several statements can be on the same line Unconventional Spacing ... data work.staff; infile 'raw-data-file'; input LastName $ 1-20 FirstName $ 21-30 JobTitle $ 36-43 Salary 54-59; run; proc means data=work.staff; class JobTitle; var Salary;run; SAS Syntax Rules
  • 35.  SAS statements are free-format  One or more blanks or special characters can be used to separate words  SAS statements can begin and end in any column  A single statement can span multiple lines  Several statements can be on the same line Unconventional Spacing ... data work.staff; infile 'raw-data-file'; input LastName $ 1-20 FirstName $ 21-30 JobTitle $ 36-43 Salary 54-59; run; proc means data=work.staff; class JobTitle; var Salary;run; SAS Syntax Rules
  • 36. data work.staff; infile 'raw-data-file'; input LastName $ 1-20 FirstName $ 21-30 JobTitle $ 36-43 Salary 54-59; run; proc means data=work.staff; class JobTitle; var Salary;run;  SAS statements are free-format  One or more blanks or special characters can be used to separate words  SAS statements can begin and end in any column  A single statement can span multiple lines  Several statements can be on the same line Unconventional Spacing SAS Syntax Rules
  • 37.  SAS statements are free-format  One or more blanks or special characters can be used to separate words  SAS statements can begin and end in any column  A single statement can span multiple lines  Several statements can be on the same line Unconventional Spacing ... data work.staff; infile 'raw-data-file'; input LastName $ 1-20 FirstName $ 21-30 JobTitle $ 36-43 Salary 54-59; run; proc means data=work.staff; class JobTitle; var Salary;run; SAS Syntax Rules
  • 38. data work.staff; infile 'raw-data-file'; input LastName $ 1-20 FirstName $ 21-30 JobTitle $ 36-43 Salary 54-59; run; proc means data=work.staff; class JobTitle; var Salary;run; ...  SAS statements are free-format  One or more blanks or special characters can be used to separate words  SAS statements can begin and end in any column  A single statement can span multiple lines  Several statements can be on the same line Unconventional Spacing SAS Syntax Rules
  • 39. data work.staff; infile 'raw-data-file'; input LastName $ 1-20 FirstName $ 21-30 JobTitle $ 36-43 Salary 54-59; run; proc means data=work.staff; class JobTitle; var Salary;run; ...  SAS statements are free-format  SAS statements can begin and end in any column  One or more blanks or special characters can be used to separate words  A single statement can span multiple lines  Several statements can be on the same line Unconventional Spacing SAS Syntax Rules
  • 40. Good spacing makes the program easier to read. Conventional Spacing data work.staff; infile 'raw-data-file'; input LastName $ 1-20 FirstName $ 21-30 JobTitle $ 36-43 Salary 54-59; run; proc print data=work.staff; run; proc means data=work.staff; class JobTitle; var Salary; run; SAS Syntax Rules
  • 41.  Type /* to begin a comment  Type your comment text  Type */ to end the comment /* Create work.staff data set */ data work.staff; infile 'raw-data-file'; input LastName $ 1-20 FirstName $ 21-30 JobTitle $ 36-43 Salary 54-59; run; /* Produce listing report of work.staff */ proc print data=work.staff; run; SAS Comments
  • 43. FILES LIBRARIES You can think of a SAS data library as a drawer in a filing cabinet and a SAS data set as one of the files in the drawer. SAS Data Libraries
  • 44. work sasuser ia work - temporary library sasuser - permanent library When you invoke SAS, you automatically have access to a temporary and a permanent SAS data library. You can create and access your own permanent libraries. ia - permanent library SAS Data Libraries
  • 45. LIBNAME libref 'SAS-data-library’;LIBNAME libref 'SAS-data-library’; Rules for naming a libref:  must be 8 characters or less  must begin with a letter or underscore  remaining characters are letters, numbers, or underscores Assigning a Libref ■ You can use the LIBNAME statement to assign a libref to a SAS data library ■ General form of the LIBNAME statement:
  • 46. ■ When you submit the LIBNAME statement, a connection is made between a libref in SAS and the physical location of files on your operating system Making the Connection Assigning a Libref libname ia 'C:Documents and Settingsam502365Desktopprog1'; Physical location
  • 47.  The first name (libref) refers to the library Every SAS file has a two-level name:  The second name (filename) refers to the file in the library The data set ia.sales is a SAS file in the ia library libref.filename sasuser work ia sales Two-level SAS Filenames
  • 48. During an interactive SAS session, the LIBNAME window enables you to investigate the contents of a SAS data library. In the LIBNAME window, you can  view a list of all the libraries available during your current SAS session  drill down to see all members of a specific library SAS Data Library
  • 50. To explore the descriptor portion of a SAS data set, specify the data set name in the DATA= option. PROC CONTENTS DATA=libref.SAS-data-set-name; RUN; PROC CONTENTS DATA=libref.SAS-data-set-name; RUN; proc contents data=ia.crew; run; Browsing a SAS Data Library
  • 51. The SAS System The CONTENTS Procedure Data Set Name: IA.CREW Observations: 69 Member Type: DATA Variables: 8 Engine: V8 Indexes: 0 Created: 15:15 Friday, Observation Length: 120 June 29, 2001 Last Modified: 15:41 Friday, Deleted Observations: 0 June 29, 2001 Protection: Compressed: NO Data Set Type: Sorted: NO Label: -----Engine/Host Dependent Information----- Data Set Page Size: 12288 Number of Data Set Pages: 1 First Data Page: 1 Max Obs per Page: 102 Obs in First Data Page: 69 Number of Data Set Repairs: 0 File Name: C:workshopwinsas prog1crew.sas7bdat Release Created: 8.0202M0 Host Created: WIN_PRO PROC CONTENTS Output – Part 1
  • 52. -----Alphabetic List of Variables and Attributes----- # Variable Type Len Format Informat 6 EmpID Char 6 3 FirstName Char 32 1 HireDate Num 8 DATE9. DATE9. 7 JobCode Char 6 2 LastName Char 32 4 Location Char 16 5 Phone Char 8 8 Salary Num 8 PROC CONTENTS Output – Part 2
  • 53. Exploring Your SAS Environment (Self-Study)