Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.

Slides:



Advertisements
Similar presentations
Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
Advertisements

Slide C.1 SAS MathematicalMarketing Appendix C: SAS Software Uses of SAS  CRM  datamining  data warehousing  linear programming  forecasting  econometrics.
Outline Proc Report Tricks Kelley Weston. Outline Examples 1.Text that spans columnsText that spans columns 2.Patient-level detail in the titlesPatient-level.
Introduction to SAS Programming Christina L. Ughrin Statistical Software Consulting Some notes pulled from SAS Programming I: Essentials Training.
I OWA S TATE U NIVERSITY Department of Animal Science Modifying and Combing SAS Data Sets (Chapter in the 6 Little SAS Book) Animal Science 500 Lecture.
SAS Programming: Working With Variables. Data Step Manipulations New variables should be created during a Data step Existing variables should be manipulated.
1 Creating and Tweaking Data HRP223 – 2010 October 24, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
The Information Delivery Process Data In Information Out ManageOrganizeExploit.
Understanding SAS Data Step Processing Alan C. Elliott stattutorials.com.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS Essentials - Elliott & Woodward1.
Into to SAS ®. 2 List the components of a SAS program. Open an existing SAS program and run it. Objectives.
Creating SAS® Data Sets
FORMAT FESTIVAL AN INTRODUCTION TO SAS® FORMATS AND INFORMATS By David Maddox.
Shell Scripting Awk (part1) Awk Programming Language standard unix language that is geared for text processing and creating formatted reports but it.
Introduction to C++ - How C++ Evolved Most popular languages currently: COBOL, Fortran, C, C++, Java (script) C was developed in 1970s at AT&T (Richie)
SAS PROC REPORT PROC TABULATE
Lecture 5 Sorting, Printing, and Summarizing Your Data.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
PROC REPORT organizes the output in many ways, from the simple to highly complex… PROC REPORT NOWINDOWS HEADLINE HEADSKIP; COLUMN variable-list; DEFINE.
Introduction to SAS BIO 226 – Spring Outline Windows and common rules Getting the data –The PRINT and CONTENT Procedures Manipulating the data.
1 Experimental Statistics - week 4 Chapter 8: 1-factor ANOVA models Using SAS.
Introduction to SAS. What is SAS? SAS originally stood for “Statistical Analysis System”. SAS is a computer software system that provides all the tools.
1 Experimental Statistics - week 2 Review: 2-sample t-tests paired t-tests Thursday: Meet in 15 Clements!! Bring Cody and Smith book.
SAS Macro: Some Tips for Debugging Stat St. Paul’s Hospital April 2, 2007.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
EPIB 698C Lecture 2 Notes Instructor: Raul Cruz 2/14/11 1.
BMTRY 789 Lecture 2 SAS Syntax, entering raw data, etc. Lecturer: Annie N. Simpson, MSc. Readings – Chapters 1, 2, 12, & 13 Lab Problems 1.1, 1.2, 1.3,
I OWA S TATE U NIVERSITY Department of Animal Science Getting Your Data Into SAS (Chapter 2 in the Little SAS Book) Animal Science 500 Lecture No. 3 September.
Lesson 2 Topic - Reading in data Chapter 2 (Little SAS Book)
1 EPIB 698E Lecture 1 Notes Instructor: Raul Cruz 7/9/13.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Lesson 6 - Topics Reading SAS datasets Subsetting SAS datasets Merging SAS datasets.
Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Chapter 5 Reading and Manipulating SAS ® Data Sets and Creating Detailed Reports Xiaogang Su Department of Statistics University of Central Florida.
Chapter 4 concerns various SAS procedures (PROCs). Every PROC operates on: –the most recently created dataset –all the observations –all the appropriate.
Chapter 17: Formatting Data 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS Essentials - Elliott & Woodward1.
Chapter 14 Formatting Readable Output. Chapter Objectives  Add a column heading with a line break to a report  Format the appearance of numeric data.
1.  Introduction  The Benefits of the Report Writer Module ◦ For Detail and Summary Printing ◦ For Control Break Processing ◦ For Printing Headings.
1 Statistical Software Programming. STAT 6360 –Statistical Software Programming Sorting, Printing, Summarizing Data Now that we can input data and do.
Chapter 1: Overview of SAS System Basic Concepts of SAS System.
SAS for Data Management and Analysis
Computing with SAS Software A SAS program consists of SAS statements. 1. The DATA step consists of SAS statements that define your data and create a SAS.
COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
FORMAT statements can be used to change the look of your output –if FORMAT is in the DATA step, then the formats are permanent and stored with the dataset.
1 Lecture 10 Introduction to AWK COP 3344 Introduction to UNIX.
Chapter 17 Supplement: Alternatives to IF-THEN/ELSE Processing STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South.
Lesson 2 Topic - Reading in data Programs 1 and 2 in course notes –Chapter 2 (Little SAS Book)
Chapter 6: Modifying and Combining Data Sets  The SET statement is a powerful statement in the DATA step DATA newdatasetname; SET olddatasetname;.. run;
SAS Programming Training Instructor:Greg Grandits TA: Textbooks:The Little SAS Book, 5th Edition Applied Statistics and the SAS Programming Language, 5.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
Online Programming| Online Training| Real Time Projects | Certifications |Online Classes| Corporate Training |Jobs| CONTACT US: STANSYS SOFTWARE SOLUTIONS.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 16 & 17 By Tasha Chapman, Oregon Health Authority.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 3 & 4 By Tasha Chapman, Oregon Health Authority.
Applied Business Forecasting and Regression Analysis
Instructor: Raul Cruz-Cano 7/9/2012
Chapter 2: Getting Data into SAS
Instructor: Raul Cruz-Cano
Tamara Arenovich Tony Panzarella
Topics Introduction to File Input and Output
SAS Essentials How SAS Thinks
Introduction to DATA Step Programming: SAS Basics II
CHAPTER 17 The Report Writer Module
Instructor: Raul Cruz 9/4/13
Topics Introduction to File Input and Output
Introduction to SAS Essentials Mastering SAS for Data Analytics
Presentation transcript:

Welcome to SAS…Session..!

What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.

SAS Programming Structure 1st Part.. The first part called the DATA step, This part describes your input data allows you to modify that data with arithmetic operations and logical decisions. The DATA Step will format your data into a special file called SASdataset.

2nd Part.. The second part of SAS is a library of canned routines called PROCEDURES. The procedures can only use SAS datasets as input. The Data step must always have preceded the Procedure section. The procedures are executed by coding a special statement in SAS called a PROC statement

Functions of DATA Step. Reads raw data from input files. Selects records from input files. Writes out the SASdatasets. Statements used in the DATA Step: DATA Statement. DATA EMPFILE --Temporary File. DATA UDEM.EMPFILE ---Permanent file

INFILE Statement : INFILE (ddname) ---for Sequential INFILE (ddname of PDS) (member name) ---for PDS INFILE (ddname) VSAM ---for VSAM

INPUT Statement : The INPUT statement describes the input data record from the INFILE statement. Standard record input : (fixed length) INPUT variable [$] [startcolumn-endcolumn] [.decimal] DATA Empfile; INPUT Empno 1-3 Name $ 4-19 Salary

Non standard record input : (like Packed dec...) Variable [$] Informat name w.[d] DATA Empfile; Empcode $15. : RUN;

Informats type. w. ---Standard numaric. w.d ---Standard numeric with decimal PDw.d ---Packed decimal. COMMAw.d ---commas in numbers

PROC Statement The PROC statement is used to invoke a SAS procedure Procedure can- Read SAS dataset Compute statistics Print report Sequence SAS datasets.

Outputting Reports

PROC PRINT Automatically formats a report from the current SAS dataset. Prints each detail record. Column headings default to the variable name but may be altered.

Syntax for to Print the default Report DATA EMPFILE; INFILE PERSON; INPUT EmpNo $ 1-3 Name $ 4-19 DOB Account 27-35; PROC PRINT; TITLE ‘EDS Employs List’; RUN;

REPORT EDS Employs List OBS EmpNo Name Account AAAA XEROX BBBB GM CCCC XEROX

Using the SORT Procedure with PROC PRINT PROC SORT; BY ACCOUNT; PROC PRINT DATA = EMPFILE; TITLE ‘EDS Employs List’; RUN;

VAR Statement VAR Statement determines which variables will be printed in the report. Order of the variables in the VAR statement is the order the variables appear in the report. PROC PRINT DATA=EMPFILE; VAR ACCOUNT EMPNO NAME; TITLE ‘EDS Employs List’; RUN;

ID Statement Suppresses printing the OBS column on the report. More than one variable can be listed in the ID statement. PROC PRINT DATA=EMPFILE; ID EMPNO; TITLE ‘EDS Employs List’; RUN;

Report EDS Employs List EmpNo Name Account 100 XXXX AAAA 101 YYYY BBBB

SUM Statement The SUM Statement specifies which numeric variables will totaled. PROC PRINT DATA=EMPFILE; SUM SALARY; TITLE ‘EDS Employs List’; RUN;

Report EDS Employs List EmpNo Name Account Salary 101 AAAA XXXX BBBB YYYY ====== ======

BY Statement This is just like Control Break in COBOL. If BY Statements are present with SUM Statement each BY group will also be totaled. PROC PRINT ; BY ACCOUNT; SUM SALARY; TITLE ‘EDS Employs List’; RUN;

EDS Employs List EmpNo Name Account Salary 100 AAAA XXXX BBBB XXXX ====== ====== 200 CCCC YYYY DDDD YYYY ====== ======

LABLE & SPLIT Statements LABLE Statement is used to assign alternate column headers to variables. The SPLIT option on the PROC PRINT statement allows multiple line alternate column headings for the report. A SPLIT character is identified with the SPLIT option.When that character is used in the LABLE text causes the label to split into multiple lines at that point

Cont.. Any character may be used to split the line. The LABLE option on the PROC PRINT statement tells SAS to use the alternative label coded in the LABEL statement. PROC PRINT LABEL/SPLIT=‘*’; : LABEL ACCOUNT=‘CLINT*NAME’;

TITLE / FOOTNOTE Statements Lines from the top correspond to the number in the TITLE. Allows up to 10 title lines to be placed at the top of each page of the report. IF TITLE line within a group of titles is not coded it will result in a blank line FOOTNOTE is similar to TITLE Statement.

PAGEBY Statement The PAGEBY variable is used with the BY Statement using the same variable. The page break occurs when the specified BY variable changes value. PROC PRINT; BY ACCOUNT; PAGEBY ACCOUNT; : RUN;

DATA Manipulations

IF Statement Indicates which observations are included in the output SAS data set. When multiple logical expressions are used (with the AND and OR ) the ANDs are resolved first. Syntax: IF var1 = var2 AND/OR var3 = var4;

WHERE Statement Used to select observations from a SAS daaset. Operators for the WHERE statement include all operators of the IF statement Operators exclusively for WHERE: WHERE Salary BETWEEN AND ;

Cont.. WHERE Name CONTAINS ‘SRINIVAS’; Searches for a character string WHERE Name LIKE ‘S%’; --selects name with the first character ‘S’ WHERE Account IN (‘GM’,’XEROX’);

DO and END Statement Execution of a DO statement specifies that all statements between the DO and its matching END are to be executed. DATA Empfile; SET Personal; IF ACCOUNT = ‘XEROX’ THEN DO; NEWSAL= SALARY*1.2; ELSE DO; NEWSAL=SALARY; END;

DROP Statement The DROP is used to specify variables that are not included in the SASdatasets being created. DATA Empfile1; SET Personal; WHERE ACCOUNT = ‘XEROX’; DROP SALARY; RUN;

DELETE Statement This statement to tell SAS to stop processing the current observation. DATA Empfile1; SET Personal; IF ACCOUNT = ‘XEROX’ THEN DELETE; : RUN;

SAS System options The OPTION statement changes SAS system options. OPTION option1 option2..; Some options: DATE, NODATE --- Puts date on title page CENTER, NOCENTER----Centers output LS ---- Linesize for output NUMBER, NONUMBER---Page numbering

Thanks…!