Hans Baumgartner Penn State University

Slides:



Advertisements
Similar presentations
Axio Research E-Compare A Tool for Data Review Bill Coar.
Advertisements

Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
SAS Programming:File Merging and Manipulation. Reading External Files (review) data barf; * create the dataset BARF; infile ’s:\mysas\Table7.1'; * open.
Slide C.1 SAS MathematicalMarketing Appendix C: SAS Software Uses of SAS  CRM  datamining  data warehousing  linear programming  forecasting  econometrics.
A “LOTTO” SAS for you! or, “Check Your Balls with SAS Arrays” By Keith McWhorter Georgia Technology Authority January 30, 2007.
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.
Today: Run SAS programs on Saturn (UNIX tutorial) Runs SAS programs on the PC.
Introduction to SQL Session 2 Retrieving Data From Multiple Tables.
Assignmnet: Simple Random Sampling With Replacement Some Solutions.
SAS PROCs ISYS 650. PROC Statement Syntax PROC name options; Statements statement options; … RUN;
4 step by step on solving linear equations
Understanding SAS Data Step Processing Alan C. Elliott stattutorials.com.
Introduction to SAS Lecture 2 Brian Healy.
Data Cleaning 101 Ron Cody, Ed.D Robert Wood Johnson Medical School Piscataway, NJ.
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
FORMAT FESTIVAL AN INTRODUCTION TO SAS® FORMATS AND INFORMATS By David Maddox.
Lecture 5 Sorting, Printing, and Summarizing Your Data.
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.
SAS SQL Part 2 Alan Elliott. Dealing with Missing Values Title "Dealing with Missing Values in SQL"; PROC SQL; select INC_KEY,GENDER, RACE, INJTYPE, case.
Chapter 20 Creating Multiple Observations from a Single Record Objectives Create multiple observations from a single record containing repeating blocks.
BMTRY 789 Lecture 3: Categorical Data and Dates Readings – Chapter 3 & 4 Lab Problems 3.1, 3.2, 3.19, 4.1, 4.3, 4.5 Homework – HW 2 Book Problems Due 6/24!
1 Experimental Statistics - week 2 Review: 2-sample t-tests paired t-tests Thursday: Meet in 15 Clements!! Bring Cody and Smith book.
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 Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
Use the UPDATE statement to: –update a master dataset with new transactions (e.g. a bank account updated regularly with deposits and withdrawals…). Not.
01/20151 EPI 5344: Survival Analysis in Epidemiology SAS code and output February 24, 2015 Dr. N. Birkett, School of Epidemiology, Public Health & Preventive.
1 Filling in the blanks with PROC FREQ Bill Klein Ryerson University.
Lesson 6 - Topics Reading SAS datasets Subsetting SAS datasets Merging SAS datasets.
Here’s another problem (see section 2.13 on page 54). A file contains two different types of records (say A’s and B’s) and we only want to read in the.
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.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS Essentials - Elliott & Woodward1.
SAS Basics. Windows Program Editor Write/edit all your statement here.
An Introduction Katherine Nicholas & Liqiong Fan.
01/20151 EPI 5344: Survival Analysis in Epidemiology Estimating S(t) from Cox models March 24, 2015 Dr. N. Birkett, School of Epidemiology, Public Health.
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.
An Introduction to Proc Transpose David P. Rosenfeld HR Consultant, Workforce Planning & Data Management City of Toronto.
Creating a mystic meg program A simple program asking the user questions and using their answers to build up a fortune telling in a list.
R Workshop #2 Basic Data Analysis. What we did last week: Understand the basics of how R works Generated objects (vectors, matrices, etc.) Read in data.
Use the SET statement to: –create an exact copy of a SAS dataset –modify an existing SAS dataset by creating new variables, subsetting (using a subsetting.
SHRUG, F EB 2013: N ETWORKING EXERCISE Many Ways to Solve a SAS Problem.
Chapter 6: Modifying and Combining Data Sets  The SET statement is a powerful statement in the DATA step DATA newdatasetname; SET olddatasetname;.. run;
Android Online Training AcuteSoft: India: , Land Line: +91 (0) USA: , UK : +44.
SAS and Other Packages SAS can interact with other packages in a variety of different ways. We will briefly discuss SPSSX (PASW) SUDAAN IML SQL will be.
Session 1 Retrieving Data From a Single Table
By Sasikumar Palanisamy
Chapter 5: Enhancing Your Output with ODS
Chapter 6: Modifying and Combining Data Sets
An Introduction to SQL.
SAS Workshop SAS Data Management Hun Myoung Park, Ph.D.
Chapter 18: Modifying SAS Data Sets and Tracking Changes
Instructor: Raul Cruz-Cano
Match-Merge in the Data Step
Chapter 4: Sorting, Printing, Summarizing
مفاهیم بهره وري.
مناهــــج البحث العلمي
Defining and Calling a Macro
Introduction to DATA Step Programming SAS Basics II
Introduction to DATA Step Programming: SAS Basics II
Outline READ DATA DATA STEPS MERGE DATA PROC IMPORT
Combining Data Sets in the DATA step.
Type=Corr SAS.
Hans Baumgartner Penn State University
5-4 The Paired t-Test OPTIONS NOOVP NODATE NONUMBER ls=80;
Week 4: Ungraded review questions
Appending and Concatenating Files
or, “Check Your Balls with SAS Arrays”
SAS Tip: split data before proc transpose
Introduction to SAS Essentials Mastering SAS for Data Analytics
Writing Robust SAS Macros
Presentation transcript:

Hans Baumgartner Penn State University Introduction to SAS Hans Baumgartner Penn State University

TITLE 'reading data from the command file'; DATA check1; INPUT id x1 x2 x3 x4 $ x5 x6; label id='respondent_id'; cards; /* or 'datalines;' */ 1xx1xx2xx3 a . 6 2 7 8 9 b 11 12 3 13 14 15 c 17 18 4 19 20 21 d 23 99 ; DATA check1; set check1; proc print; var id x1-x6; proc corr; var x1 x2; run;

TITLE 'three ways of reading in data from an external file: 1st method'; DATA check2; infile 'd:\m554\DataScreening\data.dat'; INPUT id x1 x2 x3 x4 $ x5 x6; proc print; var id x1-x6; run; TITLE 'three ways of reading in data from an external file: 2nd method'; DATA check3; INPUT id 1 x1 3-4 x2 6-7 x3 9-10 #2 x4 $ 3-4 x5 6-7 x6 9-10; TITLE 'three ways of reading in data from an external file: 3rd method'; DATA check4; INPUT (id x1 x2 x3 x4 x5 x6) (1.0,3*3.0/$4.0,2*3.0);

TITLE 'two ways of creating a file containing a subset of the original variables'; DATA check1a; set check1(keep=id x1 x2 x3); proc print; DATA check1b; set check1(drop=x4 x5 x6); run; TITLE 'selecting a subset of the original data with an if statement'; DATA check2a; set check2; if id<3;

TITLE 'recoding, transforming, creating variables, etc TITLE 'recoding, transforming, creating variables, etc.'; DATA check3a; set check3; if id<3 then group=-1; else group=1; lnx1=log(x1); logx1=log10(x1); sqrtx1=sqrt(x1); x1x2=x1*x2; arcsinx1=arsin(sqrt(x1/20)); mx123a=(x1+x2+x3)/3; mx123b=mean(x1,x2,x3); if x6=99 then x6=.; if x1<=10 or x2>=10 then s1=1; else s1=0; if x1<=10 and x2>=10 then s2=1; else s2=0; if x1 ne x2 then s3=1; else s3=0; proc print; run;

TITLE 'renaming variables in a data set'; DATA check1a; set check1a(rename=(x1=x11 x2=x12 x3=x13)); proc print; run;   TITLE 'combining two files by appending one to the other'; DATA new1; set check1a check1a; TITLE 'combining two files by merging observations based on a common variable'; DATA new2; merge check1a check1b; by id; TITLE 'writing (a subset of) data to an external file'; DATA check1; set check1; file 'd:\m554\DataScreening\data.out'; put x1 x2 4-5 @7 x3; /* ods rtf close; */ quit;