Introduction to SAS Lecturer: Chu Bin Lin.

Slides:



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

Intro to Python Welcome to the Wonderful world of GIS programing!
Today: Run SAS programs on Saturn (UNIX tutorial) Runs SAS programs on the PC.
Ann Arbor ASA ‘Up and Running’ Series: SPSS Prepared by volunteers of the Ann Arbor Chapter of the American Statistical Association, in cooperation with.
SAS BASICS Technology Short Courses: Fall 2009 Kentaka Aruga.
Introduction to SAS ISYS 650. What Is SAS? SAS is a collection of modules that are used to process and analyze data. It began in the late ’60s and early.
Categorical Data Analysis using SAS. 2 List the components of a SAS program. Open an existing SAS program and run it. Discuss the Chi Square Test of Independence.
SAS ® Regression Essentials. 2 List the components of a SAS program. Open an existing SAS program and run it. Objectives.
Copyright © 2006, SAS Institute Inc. All rights reserved. Shortcuts- what you may not know that can save you time! Elizabeth Ceranowski SAS Student Programs.
EPLS Lab Software Orientation SAS. Orientation Overview Background Getting Started SAS Windows.
SAS Workshop INTRODUCTORY ASPECTS SPRING 2012 January 20121K. F. O'Brien.
SAS Workshop Lecture 1 Lecturer: Annie N. Simpson, MSc.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
Introduction to SAS BIO 226 – Spring Outline Windows and common rules Getting the data –The PRINT and CONTENT Procedures Manipulating the data.
1 Documenting Your Project. 2 Documenting your Project Insert Banner Comments in your code Comment - coding statement used by humans not the compiler.
1 Experimental Statistics - week 4 Chapter 8: 1-factor ANOVA models Using SAS.
Quantify the Example Data First, code and quantify the data (assign column locations & variable names) Use the sample data to create a data set from the.
SAS 介绍和举例 Presented by 经济实验教学中心 商务数据挖掘中心. Raw Data Read in Data Process Data (Create new variables) Output Data (Create SAS Dataset) Analyze Data Using.
BMTRY 789 Introduction to SAS Programming Lecturer: Annie N. Simpson, MSc.
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
Knowing Understanding the Basics Writing your own code SAS Lab.
CPSC1301 Computer Science 1 Overview of Dr. Java.
EPIB 698C Lecture 2 Notes Instructor: Raul Cruz 2/14/11 1.
Chapter 1: Introduction to SAS  SAS programs: A sequence of statements in a particular order  Rules for SAS statements: –Every SAS statement ends in.
Introduction to SAS Essentials Mastering SAS for Data Analytics
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
Analyses using SPSS version 19
1 EPIB 698E Lecture 1 Notes Instructor: Raul Cruz 7/9/13.
SAS Basics. Windows Program Editor Write/edit all your statements here. Log Watch this for any errors in program as it runs. Output Will automatically.
Basics of Biostatistics for Health Research Session 1 – February 7 th, 2013 Dr. Scott Patten, Professor of Epidemiology Department of Community Health.
YET ANOTHER TIPS, TRICKS, TRAPS, TECHNIQUES PRESENTATION: A Random Selection of What I Learned From 15+ Years of SAS Programming John Pirnat Kaiser Permanente.
1 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
SAS Basics. Windows Program Editor Write/edit all your statement here.
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.
An Introduction to Proc Transpose David P. Rosenfeld HR Consultant, Workforce Planning & Data Management City of Toronto.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
1 Introduction to SAS Available at
© Peter Andreae Java Programs COMP 102 # T1 Peter Andreae Computer Science Victoria University of Wellington.
Introduction to Programming Python Lab 7: if Statement 19 February PythonLab7 lecture slides.ppt Ping Brennan
1 EPIB 698C Lecture 1 Instructor: Raul Cruz-Cano
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
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.
Appendix A Barb Ericson Georgia Institute of Technology May 2006
PubH 6420 Introduction to SAS Programming
Appendix A Barb Ericson Georgia Institute of Technology May 2006
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
Introduction to SAS®.
SAS Programming Introduction to SAS.
ECONOMETRICS ii – spring 2018
How to Import an Excel File
Chapter 1: Introduction to SAS
Instructor: Raul Cruz-Cano
Match-Merge in the Data Step
Tamara Arenovich Tony Panzarella
Introduction to SAS A SAS program is a list of SAS statements executed in order Every SAS statement ends with a semicolon! SAS statements can be in caps.
Introduction to DATA Step Programming SAS Basics II
Introduction to Programming
Introduction to DATA Step Programming: SAS Basics II
Outline READ DATA DATA STEPS MERGE DATA PROC IMPORT
Creating Your First C Program Using Visual Studio 2010
Creating Your First C Program Using Visual Studio 2010
SAS® Regression Essentials
CPS120: Introduction to Computer Science
Instructor: Raul Cruz 9/4/13
Introduction to Programming
Introduction to SAS Essentials Mastering SAS for Data Analytics
Workshop for Programming And Systems Management Teachers
Wilcoxon Rank-Sum Test
Presentation transcript:

Introduction to SAS Lecturer: Chu Bin Lin

The SAS window

The SAS window

The SAS window 1. Editor 2. Log 3. Output 4. Results viewer 5. Results window 6. Explorer

The SAS window

The SAS window Two ways to run your programs: 1. 2.

The SAS language

The SAS language SAS programs: A SAS program is a sequence of statements executed in order. SAS statements: Every SAS statement ends with a semicolon!

The SAS language Layout of SAS programs: 1. SAS statements can be in upper- or lowercase. 2. Statements can continue on the next line (as long as you don’t split words in two). 3. Statements can be on the same line as other statements. 4. Statements can start in any column.

The SAS language Comments: There are two styles of comments you can use: 1. starts with an asterisk (*) and ends with a semicolon (;). 2. The other style starts with a slash asterisk (/*) and ends with an asterisk slash (*/). The

The SAS language SAS programs are constructed from two basic building blocks: DATA steps and PROC steps. A typical program starts with a DATA step to create a SAS data set and then passes the data to a PROC step for processing.

The SAS language Here is a simple program that converts miles to kilometers in a DATA step and prints the results with a PROC step:

The SAS language

Create a data set

Create a dataset I data score; input name $ chinese english math; datalines; Wang 67 78 98 John 78 77 95 Mary 44 91 100 Scott 67 98 85 Stanley 67 93 78 ; run;

Create a dataset I data score1; set score; sum=chinese+english+math; average=(chinese+english+math)/3; run;

Create a dataset II DATA HW; INPUT ID NAME $ HEIGHT WEIGHT; DATALINES; 1 SEAN 177 77 2 MARY 165 57 3 PETER 188 79 4 SCOTT 173 65 5 WANG 169 72 6 JOHN 180 95 7 WENDY 166 43 ; RUN;

Create a dataset II DATA HW1; SET HW; BMI= WEIGHT/((HEIGHT/100)**2); RUN; DATA FAT THIN; SET HW1; IF BMI>= 24 THEN OUTPUT FAT; IF BMI < 17 THEN OUTPUT THIN;

Import a dataset

Import a dataset Two ways to import an outside dataset 1. Use Proc statement PROC IMPORT DATAFILE = 'C:\Users\Sean\Dropbox\2016\SWJTU\SAS\example.xlsx' OUT = example REPLACE; RUN; 2. Click on pull down Menus

Proc steps

Proc print and proc sort 1. proc print data=example; run; 2. proc sort data=example; by id;

Proc means proc means data= example; var total read write math science socst; run;

Proc freq and proc gchart 1. proc freq data=example; tables grade; run; 2. proc gchart data=example; hbar grade ;

Save code and export dataset 1. Editor -> Save -> follow the wizard 2. File -> export data -> follow the wizard

Two more tips 1. Start from a small program. Get use to trial and error. 2. SAS help and documentation

Thank you for listening.