Collection and Analysis of Data CPH 608 Spring 2015
Analysis "What gets measured gets done." —Anonymous
SAS-A Brief Introduction Lava Timsina 2/25/2015 3
Outline Installing SAS Data structure Reading Data Data management Analysis Simple Graphs Exporting your results 4
Installing SAS Download Register to get licensing information and installation instructions for SAS Virtual desktop environment (MyVirtualDen) provided by UKIT 5
Data Structures Common data formats – SAS data sets – MS Excel and MS Access – DBMS tables – Text files – SPSS … 6
Data Structures SAS Data Set – Columns: Variables Name – Begins with letter or underscores but may contain numbers as well. Spaces are not allowed Type – Define character (String) or numeric Length – Rows: Observations 7
Data: ID NAMEGENDEREXAM 1EXAM 2HOMEWORK GRADE STATE 1001 Lava Timsina M ANew Jersey 1002Ramesh Neupane M ANebraska Writing data 8
Example SAS code
Reading data Reading data from external files Importing files Processing of data Creating permanent data for future use Creating log file for future reference 10
Example SAS code ExampleNLSPHS
Permanent SAS Data Creating permanent sas datafiles (*.sas7bdat) – Need to define a sas library – Need to specify the path/directory for the library 12
Example SAS Code 13
Data Management Creating variables Deleting variables Deleting observations Renaming variables 14
Example SAS Code 15
Analysis Descriptive statistics Regression- bivariate and multivariate linear 16
Procedures in SAS Some basic procedures in SAS – Proc freq – Proc means – Proc univariate – Proc sgplot – Proc corr – Proc reg – Proc logistic – Proc gchart 17
Output the results PDF RTF CSV HTML XLS … 18
SAS codes-examples 19
learndataanalysis.wordpress.com