| SAS Programs |
Program Name |
Description of Data Steps and PROCs |
| Introduction- Entering Data |
estest1.sas |
Directly enter some data into SAS using a program. |
| Documenting SAS Programs |
header.sas |
Statement to help keep track of SAS programs |
| Read Sortumme Data, and get histogram for age. |
ejs09b540p01.sas
ejs09b540p02.sas
ejs09b540p03.sas ejs09b540p04.sas
|
Contents, Print, Univariate, Plots, Freq |
| Read Seasons Baseline Data |
ejs09b540p05.sas |
LIBNAME and engines, UNIVARIATE and histograms, FOOTNOTE |
| Description of Energy by Gender |
ejs09b540p05b.sas |
SORT ; BY gender; and using BY statements, HISTORGRAM /MIDPOINTS |
| Get Proportion of Subjects within 1 SD of mean (Seasons data) |
ejs09b540p06.sas |
DATA Step, ABS function, IF THEN statement, LABEL |
| Get Proportion of Subjects within 1 and 1.5 SD of mean (Seasons data) |
ejs09b540p07.sas |
MEANS and OUTPUT, PRINT and NOOBS and LABEL , FORMAT |
| Automate getting mean and standard deviation (Seasons Data) |
ejs09b540p08.sas |
MEANS and OUPPUT, IF _N_=1 THEN SET (KEEP=) and Subsequent SET (One record to multiple merging)
ARRAY , DO loop, |
| Macro to get mean, std, and proportions within X std of mean (Seasons Data) |
ejs09b540p09.sas |
%MACRO bands (v1=); and $MEND and &v1 . Running marcros: %bands (v1-age); |
| Macro with more than one variable (Seasons data) |
ejs09b540p10.sas |
SET _NULL_; DATA... SET statement to concatenate data sets, FORMAT |
| Simulate normal data with n=20 |
ejs09b540p11.sas |
DO loops, OUTPUT , RANNOR(2432)- same sample each run. |
| Simulate normal data with n=20 |
ejs09b540p12.sas |
RANNOR(0)- different sample each run |
| Simulate normal data with n=20 |
ejs09b540p13.sas |
Using Macro Variables in programs: %LET n=20; |
| Simulate normal data with n=?? with bands using std width to determine proportions |
ejs09b540p14.sas |
Combining ejs09b540p13.sas with ejs09b540p10.sas. |
| Read Excel data with sample means and se, create file that plots simultaneous intervals (based on multiple of se) for illustration |
ejs09b540p16.sas |
Proc GPLOT, Symbol, Axis, Overlay, and Axis ranges |
| Application with SRS w/o rep for n=3 from N=3 with true var |
ejs09b540p17.sas |
PROC Freq, Proc GPLOT, Symbol, Axis, Overlay, and Axis ranges |
| Application with SRS w/o rep for n=3 from N=3 with estimated SE |
ejs09b540p18.sas |
as in p17. |
| Select SRS w rep from N=5 with n=3 (example) |
ejs09b540p19.sas |
DATA ... INPUT ..OUTPUT to multiple data, ARRAYS
PROC Transpose, |
| Select multiple SRS w rep from N=5 with n=3 |
ejs09b540p20.sas |
Use Macro Variables for N, n, and # of repeated samples.
DATA step- Use functions MEDIAN(OF y1-y3)
MEAN(OF y1-y3)
MAX(OF y1-y3)
MIN(OF y1-y3) |
| Select SRS w/o replacement of n=3 from N=5, and generate labels for sample subjects (example) |
ejs09b540p21.sas |
DATA step: Arrays and Do loops |
| Select SRS w/o replacement of n from N, and generate labels for sample subjects (operational) |
ejs09b540p22.sas |
as in program 21, but using macro variables for n, N, and number of trials. |
| Example of SRS w/o replacement with 10, 000 samples to check that each is equally likely. |
ejs09b540p23.sas |
Functions for max, min, and median to order labels in sample. |
| Select SRS w/o Rep of n=3 from N=5 and get median, mean, and average of min and max. |
ejs09b540p24.sas |
Use macro variables, and DATA with IF _N_=1 THEN SET to add data to samples |
| Select SRS w/o Rep of n=3 from N=5 and get median, mean, and average of min and max, and summarize results for 100,000 samples, tabulating the expected value and variance of the estimators.. |
ejs09b540p25.sas |
PROC MEANS with option for VARDEF=n (to get variance divided by n) and MAXDEC=2 to control decimal output. |
| Select SRS w/o Rep of n=25 from N=291 in Seasons study to evaluate estimators of the median age, using the sample median, mean, and average of min and max. Here we take 100 samples., and summarize results tabulating the expected value and variance of the estimators. |
ejs09b540p26.sas |
This is the same idea as program 25, but now we read in a previously created SAS data set. Also this includes histograms of the estimators. |
| Investigate estimates of the percent Kcal intake from fat in the Seasons Population of N=291 subjects based on samples of size n=25 without replacment |
ejs09b540p27.sas |
Uses program 26, with some minor changes. |
| Determine central 95% of distribution of sample means. (srs w/o rep of n=5 from N=291 for LDL in seasons study) |
ejs09b540p28.sas |
PROC Univariate and estimating 2.5 and 97.5 percentiles of distribution of sample means. |
| Program similar to ejs09b540p26.sas to solve problem 1 in be540-sampling-problems3 |
ejs09b540p29.sas |
|
| Pick a single simple random sample from a population without replacement |
ejs09b540p30.sas |
Special case of ejf09b540p28.sas |
| Pick multiple samples without replacement for TG with a given sample size, plot the results, and get the expected value and variance of sample means. |
ejs09b540p31.sas |
Uses macro variables to define variable that is sampled from the Seasons study |
| Pick a single simple random sample from a population without replacement using TG for a sample of n=50 |
ejs09b540p33.sas |
Get overlay of multiple possible interval estimates of a population parameter |
| Examples of estimation problems, defining new variables, getting statistics by group. |
ejs09b540p34.sas |
|
| Computing the Covariance and correlation |
ejs09b540p35.sas |
PROC CORR COV;
PROC GPLOT; PLOT; |
| Estimation examples |
ejs09b540p36.sas |
|
| Basic Ideas for Hypothesis testing |
ejs09b540p37.sas |
|
| Getting SAS output for Assignment on Linear Combinations of RV, Stochastic Models, Covariance, and Independence (be540-sampling-problems-4.doc) |
ejs09b540p38.sas |
|
| Read Seasons Data set (Exam 2 program) |
ejs09b540p39.sas |
|
| Simulate simple random samples and get distribution of sample means (Exam 2 program) |
ejs09b540p40.sas |
|
| Simulate 20 samples with confidence intervals (Exam 2 program) |
ejs09b540p41.sas |
|
| Introduction to Hypothesis testing homework |
ejs09b540p42.sas |
Create sampling distribution, and use it to get critical region for hypothesis tests |
| Hypothesis testing Chapter 10-9 |
ejs09b540p43.sas |
Proc Means |
| Hypothesis Testing Chapter 10-11 |
ejs09b540p44.sas |
Proc TTEST |
| Sampling with replacement |
ejs09b540p45.sas |
Example of SRS with replacement simulation based on finite population. |
| SRS with Rep Bernoulli RV in Seasons Study |
ejs09b540p46.sas |
Example reading Seasons data, cateogorizing variable for TC, selecting samples. |
| SRS with rep for Binomial RV from Seasons study with histograms |
ejs09b540p47.sas |
Create histograms of Sample total, and sample mean to compare with Binomial Dist. |
| Testing hypotheses with Binomial Distribution- Large sample z and chi-square test |
ejs09b540p48.sas |
Histograms of test statistics for many samples. |
| Comparison of Test statistic with null distribution for Binomial based on simulating Null distribution, with Season's study reference |
ejs09b540p49.sas |
Chi-square and z null distributions for simulations. |
| Chi-square tests and 2-sample t-tests |
ejs09b540p50.sas |
PROC FREQ, PROC TTEST |
| Question 5 Program for Exam 3 (fall09) |
ejs09b540p51.sas |
UNIVARIATE, TTEST |
| Question 5 Solution Program for Exam 3 (Fall 09) |
ejs09b540p52.sas |
|
| Fall 2009 Final Exam program |
ejs09b540p53.sas |
Description of Male TC |
| Fall 2009 Final exam solution program |
ejs09b540p54.sas |
|
| Read in a SAS Dataset, simple description. |
estest2.sas
Data: laheart |
Naming programs, using a LIBNAME statement, CONTENTS, MEANS, SORT |
| Histograms, plots and 1 sample t-tests, Frequency, Chi-square tests |
estest3.sas
Data: laheart |
UNIVARIATE, PLOT, GPLOT, TTEST, FREQ |
| 2-sample t-tests, correlation, regression |
estest4.sas
Data: laheart |
CORR, REG, GPLOT |
| Examples of Scatter Plots |
estest5.sas Data: laheart |
GPLOT and options |
| Simple Linear Regression |
esb09p01.sas
Data: laheart |
Simple Linear regression |
| Simple Linear Regression |
esb09p02.sas
Data: none |
Simple Linear regression with IML |
| Simple Linear Regression |
esb05p07.sas Data: laheart |
Simple Linear regression |
| Scatter plot for pulse with age |
esb05p12.sas |
GPLOT |
| Data set creation program |
esb05p13.sas |
Program to create Seasons Data combining Baseline and quarter data |
| T-tests and 1 Way Anova (Assign 7.1) |
esb05p26.sas |
T-TEST, ANOVA, GLM |
| T-tests and 1 Way Anova (Assign 7.2- weighting of means) |
esb05p30.sas |
T-TEST, ANOVA, GLM |