SlideShare une entreprise Scribd logo
1  sur  68
SAS Basics   24 August 2007
An Overview of the SAS System
Objectives ,[object Object],[object Object]
Components of the SAS System Base SAS Reporting  and  Graphics Analytical Visualization and Discovery Data Access and Management Business Solutions User Interfaces Application Development Web Enablement
[object Object],[object Object],[object Object],[object Object],[object Object],Data-Driven Tasks
Turning Data into Information ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Turning Data into Information DATA Step SAS  Data  Sets Data PROC Steps Information
Design of the SAS System PC Workstation Servers / Midrange Mainframe Super Computer 90% independent 10% dependent MultiVendor Architecture
Design of the SAS System MultiEngine Architecture ™ DATA INGRES SYBASE INFORMIX ORACLE dBase Rdb DB2
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Course Scenario
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Course Scenario
Chapter 2 Getting Started with the SAS System
Section 2.1 Introduction to SAS Programs
[object Object],[object Object],Objectives
SAS Programs 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 DATA Step Report SAS Data Set SAS Data Set PROC Step
SAS Programs 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
Step Boundaries ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
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; proc  means data=work.staff; class JobTitle; var Salary; run; Step Boundaries
Running a SAS Program ,[object Object],[object Object],[object Object],[object Object],[object Object]
SAS Windowing Environment Interactive windows enable you to interface with SAS.
OS/390 (MVS) Batch Execution Place the JCL appropriate for your location before your SAS statements. //jobname JOB accounting info,name … // EXEC SAS //SYSIN DD * 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;
Noninteractive Execution (Optional) ,[object Object],[object Object],[object Object],[object Object],[object Object],SAS  filename SAS INPUT( filename )
Section 2.2 Running SAS Programs
[object Object],[object Object],[object Object],Objectives
Submitting a SAS Program 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.
SAS Log 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.
PROC PRINT Output 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 MEANS Output The SAS System The MEANS Procedure Analysis Variable : Salary N JobTitle  Obs  N  Mean  Std Dev  Minimum ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ Mechanic  8  8  58750.00  19151.65  36000.00 Pilot  10  10  73750.00  22523.14  45000.00 ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ Analysis Variable : Salary N JobTitle  Obs  Maximum ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ Mechanic  8  80000.00 Pilot  10  105000.00 ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
Running a SAS Program c02s2d1.sas  userid .prog1.sascode(c02s2d1) ,[object Object]
Exercises ,[object Object],[object Object]
Section 2.3 Mastering Fundamental Concepts
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Objectives
SAS Data Sets Data  Entry External File Conversion Process SAS  Data Set Descriptor Portion Data Portion Other Software Files
SAS Data Sets SAS data sets have a descriptor portion and a 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 * Position * Format * Informat  * Label Descriptor Portion Data Portion
[object Object],[object Object],[object Object],[object Object],Browsing the Descriptor Portion
[object Object],[object Object],Browsing the Descriptor Portion PROC CONTENTS DATA= SAS-data-set ; RUN; proc contents data=work.staff; run; c02s3d1
Partial PROC CONTENTS Output 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  Pos ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ 2  FirstName  Char  10  28 3  JobTitle  Char  8  38 1  LastName  Char  20  8 4  Salary  Num  8  0
SAS Data Sets: Data Portion 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 Variable Values ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],SAS Data Set and Variable Names
[object Object],Valid SAS Names  data5mon  5monthsdata  five months data    fivemonthsdata  data#5
[object Object],Valid SAS Names    fivemonthsdata  data5mon  data5mon    5monthsdata    five months data    fivemonthsdata    data#5
[object Object],[object Object],SAS Date Values 01JAN1959 01JAN1960 01JAN1961 store -365 0 366 display 01/01/1959 01/01/1960 01/01/1961
Missing Data 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.
[object Object],[object Object],[object Object],[object Object],[object Object],Browsing the Data Portion
[object Object],[object Object],Browsing the Data Portion PROC PRINT DATA= SAS-data-set ; RUN; proc print data=work.staff; run; c02s3d1
PROC PRINT Output 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 Data Set Terminology SAS documentation and text in the SAS windowing environment use the following terms interchangeably: SAS Data Set SAS Table Variable Column Observation Row
[object Object],[object Object],[object Object],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 Syntax Rules ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],... 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 ... ... ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],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; ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
SAS Syntax Rules ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],... 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; ... ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
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; ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Good spacing makes the program easier to read. Conventional Spacing data work.staff; infile ' raw-data-file '; input LastName $ 1-20 FirstName $ 21-30 JobTaitle $ 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
[object Object],[object Object],[object Object],/*   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; c02s3d2 SAS Comments
[object Object],Exercises
Section 2.4 Diagnosing and Correcting Syntax Errors
[object Object],[object Object],[object Object],[object Object],Objectives
Syntax Errors daat 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 average max; class JobTitle; var Salary; run; ,[object Object],[object Object],[object Object],[object Object]
Debugging a SAS Program  c02s4d1.sas  userid .prog1.sascode(c02s4d1) c02s4d2.sas userid .prog1.sascode(c02s4d2) ,[object Object]
Recall a Submitted Program daat 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 average max; class JobTitle; var Salary; run; 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 mean max; class Jobtitle; var Salary; run; Program statements accumulate in a recall buffer each time you issue a SUBMIT command. Submit Number 1 Submit Number 2
Recall a Submitted Program Submit Number 1 Submit Number 2 Issue RECALL once. Submit number 2 statements are recalled. Issue the RECALL command once to recall the most recently submitted program. 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 mean max; class JobTitle; var Salary; run;
Recall a Submitted Program Submit Number 1 Submit Number 2 daat 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 average max; class JobTitle; var Salary; run; 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 mean max; class JobTitle; var Salary; run; Issue RECALL again. Issue the RECALL command again to recall submit number 1 statements.
Review: Save Your Program Use the FILE command with the appropriate file naming convention for your operating environment. OS/390:  UNIX: Windows: FILE  ' userid.prog1 .sascode( myprog )' FILE  '/users/prog1/ myprog .sas' FILE  'c:orkshopinsasrog1myprog .sas'
Exercises ,[object Object]
Section 2.5 Exploring Your SAS Environment (Self-Study)

Contenu connexe

Tendances

Learn SAS Programming
Learn SAS ProgrammingLearn SAS Programming
Learn SAS ProgrammingSASTechies
 
Basics Of SAS Programming Language
Basics Of SAS Programming LanguageBasics Of SAS Programming Language
Basics Of SAS Programming Languageguest2160992
 
Base sas interview questions
Base sas interview questionsBase sas interview questions
Base sas interview questionsDr P Deepak
 
Understanding SAS Data Step Processing
Understanding SAS Data Step ProcessingUnderstanding SAS Data Step Processing
Understanding SAS Data Step Processingguest2160992
 
Introduction To Sas
Introduction To SasIntroduction To Sas
Introduction To Sashalasti
 
Utility Procedures in SAS
Utility Procedures in SASUtility Procedures in SAS
Utility Procedures in SASguest2160992
 
Data Match Merging in SAS
Data Match Merging in SASData Match Merging in SAS
Data Match Merging in SASguest2160992
 
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 SASizahn
 
Introduction to SAS
Introduction to SASIntroduction to SAS
Introduction to SASImam Jaffer
 
Introduction to SAS Data Set Options
Introduction to SAS Data Set OptionsIntroduction to SAS Data Set Options
Introduction to SAS Data Set OptionsMark Tabladillo
 
Salesforce Summer 14 Release
Salesforce Summer 14 ReleaseSalesforce Summer 14 Release
Salesforce Summer 14 ReleaseJyothylakshmy P.U
 
Understanding sas data step processing.
Understanding sas data step processing.Understanding sas data step processing.
Understanding sas data step processing.Ravi Mandal, MBA
 
Sas Talk To R Users Group
Sas Talk To R Users GroupSas Talk To R Users Group
Sas Talk To R Users Groupgeorgette1200
 
A Step-By-Step Introduction to SAS Report Procedure
A Step-By-Step Introduction to SAS Report ProcedureA Step-By-Step Introduction to SAS Report Procedure
A Step-By-Step Introduction to SAS Report ProcedureYesAnalytics
 

Tendances (20)

Learn SAS Programming
Learn SAS ProgrammingLearn SAS Programming
Learn SAS Programming
 
SAS Macros
SAS MacrosSAS Macros
SAS Macros
 
SAS - Training
SAS - Training SAS - Training
SAS - Training
 
Basics Of SAS Programming Language
Basics Of SAS Programming LanguageBasics Of SAS Programming Language
Basics Of SAS Programming Language
 
Base sas interview questions
Base sas interview questionsBase sas interview questions
Base sas interview questions
 
Understanding SAS Data Step Processing
Understanding SAS Data Step ProcessingUnderstanding SAS Data Step Processing
Understanding SAS Data Step Processing
 
Introduction To Sas
Introduction To SasIntroduction To Sas
Introduction To Sas
 
Utility Procedures in SAS
Utility Procedures in SASUtility Procedures in SAS
Utility Procedures in SAS
 
Data Match Merging in SAS
Data Match Merging in SASData Match Merging in SAS
Data Match Merging in SAS
 
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
 
Introduction to SAS
Introduction to SASIntroduction to SAS
Introduction to SAS
 
SAS ODS HTML
SAS ODS HTMLSAS ODS HTML
SAS ODS HTML
 
SAS basics Step by step learning
SAS basics Step by step learningSAS basics Step by step learning
SAS basics Step by step learning
 
Introduction to SAS Data Set Options
Introduction to SAS Data Set OptionsIntroduction to SAS Data Set Options
Introduction to SAS Data Set Options
 
SAS Internal Training
SAS Internal TrainingSAS Internal Training
SAS Internal Training
 
Salesforce Summer 14 Release
Salesforce Summer 14 ReleaseSalesforce Summer 14 Release
Salesforce Summer 14 Release
 
Understanding sas data step processing.
Understanding sas data step processing.Understanding sas data step processing.
Understanding sas data step processing.
 
Sas Talk To R Users Group
Sas Talk To R Users GroupSas Talk To R Users Group
Sas Talk To R Users Group
 
A Step-By-Step Introduction to SAS Report Procedure
A Step-By-Step Introduction to SAS Report ProcedureA Step-By-Step Introduction to SAS Report Procedure
A Step-By-Step Introduction to SAS Report Procedure
 

Similaire à Prog1 chap1 and chap 2

Sas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary ToolSas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary Toolsysseminar
 
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 Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19cSQL Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19cRachelBarker26
 
SQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQLSQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQLJerry Yang
 
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
 
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)Serban Tanasa
 
SAS Online Training Institute in Hyderabad - C-Point
SAS Online Training Institute in Hyderabad - C-PointSAS Online Training Institute in Hyderabad - C-Point
SAS Online Training Institute in Hyderabad - C-Pointcpointss
 
Sql Automation 20090610
Sql Automation 20090610Sql Automation 20090610
Sql Automation 20090610livingco
 
Save Coding Time with Proc SQL.ppt
Save Coding Time with Proc SQL.pptSave Coding Time with Proc SQL.ppt
Save Coding Time with Proc SQL.pptssuser660bb1
 
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.
 
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 sasAjay Ohri
 
SecZone 2011: Scrubbing SAP clean with SOAP
SecZone 2011: Scrubbing SAP clean with SOAPSecZone 2011: Scrubbing SAP clean with SOAP
SecZone 2011: Scrubbing SAP clean with SOAPChris John Riley
 

Similaire à Prog1 chap1 and chap 2 (20)

Sas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary ToolSas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary Tool
 
SAS Programming Notes
SAS Programming NotesSAS Programming Notes
SAS Programming Notes
 
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)
 
SAS - overview of SAS
SAS - overview of SASSAS - overview of SAS
SAS - overview of SAS
 
SQL Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19cSQL Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19c
 
SQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQLSQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQL
 
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
 
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
 
SAS Online Training Institute in Hyderabad - C-Point
SAS Online Training Institute in Hyderabad - C-PointSAS Online Training Institute in Hyderabad - C-Point
SAS Online Training Institute in Hyderabad - C-Point
 
Mysql
MysqlMysql
Mysql
 
Sas classes in mumbai
Sas classes in mumbaiSas classes in mumbai
Sas classes in mumbai
 
Sql Automation 20090610
Sql Automation 20090610Sql Automation 20090610
Sql Automation 20090610
 
Save Coding Time with Proc SQL.ppt
Save Coding Time with Proc SQL.pptSave Coding Time with Proc SQL.ppt
Save Coding Time with Proc SQL.ppt
 
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
 
pm1
pm1pm1
pm1
 
SAS/Tableau integration
SAS/Tableau integrationSAS/Tableau integration
SAS/Tableau integration
 
Introduction to-sas-1211594349119006-8
Introduction to-sas-1211594349119006-8Introduction to-sas-1211594349119006-8
Introduction to-sas-1211594349119006-8
 
Introduction to sas
Introduction to sasIntroduction to sas
Introduction to sas
 
SecZone 2011: Scrubbing SAP clean with SOAP
SecZone 2011: Scrubbing SAP clean with SOAPSecZone 2011: Scrubbing SAP clean with SOAP
SecZone 2011: Scrubbing SAP clean with SOAP
 
Pl sql using_xml
Pl sql using_xmlPl sql using_xml
Pl sql using_xml
 

Dernier

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 

Dernier (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 

Prog1 chap1 and chap 2

  • 1. SAS Basics 24 August 2007
  • 2. An Overview of the SAS System
  • 3.
  • 4. Components of the SAS System Base SAS Reporting and Graphics Analytical Visualization and Discovery Data Access and Management Business Solutions User Interfaces Application Development Web Enablement
  • 5.
  • 6.
  • 7. Turning Data into Information DATA Step SAS Data Sets Data PROC Steps Information
  • 8. Design of the SAS System PC Workstation Servers / Midrange Mainframe Super Computer 90% independent 10% dependent MultiVendor Architecture
  • 9. Design of the SAS System MultiEngine Architecture ™ DATA INGRES SYBASE INFORMIX ORACLE dBase Rdb DB2
  • 10.
  • 11.
  • 12. Chapter 2 Getting Started with the SAS System
  • 13. Section 2.1 Introduction to SAS Programs
  • 14.
  • 15. SAS Programs 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 DATA Step Report SAS Data Set SAS Data Set PROC Step
  • 16. SAS Programs 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
  • 17.
  • 18. 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; proc means data=work.staff; class JobTitle; var Salary; run; Step Boundaries
  • 19.
  • 20. SAS Windowing Environment Interactive windows enable you to interface with SAS.
  • 21. OS/390 (MVS) Batch Execution Place the JCL appropriate for your location before your SAS statements. //jobname JOB accounting info,name … // EXEC SAS //SYSIN DD * 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;
  • 22.
  • 23. Section 2.2 Running SAS Programs
  • 24.
  • 25. Submitting a SAS Program 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.
  • 26. SAS Log 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.
  • 27. PROC PRINT Output 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
  • 28. PROC MEANS Output The SAS System The MEANS Procedure Analysis Variable : Salary N JobTitle Obs N Mean Std Dev Minimum ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ Mechanic 8 8 58750.00 19151.65 36000.00 Pilot 10 10 73750.00 22523.14 45000.00 ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ Analysis Variable : Salary N JobTitle Obs Maximum ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ Mechanic 8 80000.00 Pilot 10 105000.00 ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
  • 29.
  • 30.
  • 31. Section 2.3 Mastering Fundamental Concepts
  • 32.
  • 33. SAS Data Sets Data Entry External File Conversion Process SAS Data Set Descriptor Portion Data Portion Other Software Files
  • 34. SAS Data Sets SAS data sets have a descriptor portion and a 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 * Position * Format * Informat * Label Descriptor Portion Data Portion
  • 35.
  • 36.
  • 37. Partial PROC CONTENTS Output 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 Pos ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ 2 FirstName Char 10 28 3 JobTitle Char 8 38 1 LastName Char 20 8 4 Salary Num 8 0
  • 38. SAS Data Sets: Data Portion 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
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44. Missing Data 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.
  • 45.
  • 46.
  • 47. PROC PRINT Output 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
  • 48. SAS Data Set Terminology SAS documentation and text in the SAS windowing environment use the following terms interchangeably: SAS Data Set SAS Table Variable Column Observation Row
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56. Good spacing makes the program easier to read. Conventional Spacing data work.staff; infile ' raw-data-file '; input LastName $ 1-20 FirstName $ 21-30 JobTaitle $ 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
  • 57.
  • 58.
  • 59. Section 2.4 Diagnosing and Correcting Syntax Errors
  • 60.
  • 61.
  • 62.
  • 63. Recall a Submitted Program daat 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 average max; class JobTitle; var Salary; run; 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 mean max; class Jobtitle; var Salary; run; Program statements accumulate in a recall buffer each time you issue a SUBMIT command. Submit Number 1 Submit Number 2
  • 64. Recall a Submitted Program Submit Number 1 Submit Number 2 Issue RECALL once. Submit number 2 statements are recalled. Issue the RECALL command once to recall the most recently submitted program. 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 mean max; class JobTitle; var Salary; run;
  • 65. Recall a Submitted Program Submit Number 1 Submit Number 2 daat 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 average max; class JobTitle; var Salary; run; 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 mean max; class JobTitle; var Salary; run; Issue RECALL again. Issue the RECALL command again to recall submit number 1 statements.
  • 66. Review: Save Your Program Use the FILE command with the appropriate file naming convention for your operating environment. OS/390: UNIX: Windows: FILE ' userid.prog1 .sascode( myprog )' FILE '/users/prog1/ myprog .sas' FILE 'c:orkshopinsasrog1myprog .sas'
  • 67.
  • 68. Section 2.5 Exploring Your SAS Environment (Self-Study)

Notes de l'éditeur

  1. When there are too many columns to fit on one line, they are split into multiple lines by PROC PRINT.