/********************************************** This example shows how to import an Excel File, set up missing value codes and create some new variables. New variables are also created. Filename: descriptives.sas **********************************************/ PROC IMPORT OUT= WORK.owen DATAFILE= "C:\temp\labdata\Owen.xls" DBMS=EXCEL2000 REPLACE; GETNAMES=YES; RUN; proc means data=owen; title "Descriptive Statistics for All Numeric Variables"; run; data owen2; set owen; if vit_a = 99 then vit_a = .; if head_cir = 99 then head_cir = .; if fatfold = 99 then fatfold = .; if b_weight = 999 then b_weight= .; if mot_age = 99 then mot_age = .; if b_order = 99 then b_order = .; if m_height = 999 then m_height=.; if f_height = 999 then f_height=.; bwt_g = b_weight*10; if bwt_g not=. and bwt_g < 2500 then lowbwt=1; if bwt_g >=2500 then lowbwt=0; run; /*Univariate Statistics and Graphs*/ proc means data=owen2; title "Descriptive Statistics for All Numeric Variables"; title2 "After Fixing Missing Value Codes"; run; proc contents data=owen2; title "Contents of SAS Data Set"; run; proc freq data=owen2; tables childnum sex race w_rank b_order lowbwt; title "Frequencies for Categorical Variables"; run; proc chart data=owen2; hbar sex race w_rank b_order lowbwt / discrete; title "Bar Charts for Categorical Variables"; run; proc univariate data=owen2 plot; var age income_c -- f_height; histogram; title "Histogram for Continuous Variables"; run; /*Bivariate Relationships of Two Categorical Variables*/ proc freq data=owen2; tables sex*childnum; title "Crosstabulation of Sex and Child Number"; run; /*Bivariate Relationships of Two Continuous Variables*/ proc plot data=owen2; plot weight * height; title "Scatter Plot of Weight vs Height"; run; /*Bivariate Relationships of Continuous vs. Categorical Variable*/ proc sort data=owen2; by sex; run; proc univariate data=owen2 plot; by sex; var weight; title "Side-by-Side Boxplot Using Proc Univariate"; run; proc boxplot data=owen2; plot weight*sex; title "Side-by-Side Boxplot Using Proc Boxplot"; run;