SAS Flashcards
Code to import data
data work.datasetname; input age weight height; label age = 'Patient Age'; cards; 24 130 65 30 150 70; run;
printing data
proc print run;
UNIVARIATE procedure does what
for each variable prints summary statistics
extreme observations, stem and leaf, basic stats (mean/median/mode/deviation/stdev/range/IQR), quartiles, t-test, sign, signed rank
USE TO EXPLORE NEW DATASET
proc UNIVARIATE code
proc univariate data = setName plot; (plot not necess.) var weight; histogram weight; (not necessary) Title1='Age study'; run;
what does the CORR procedure do
shows simple statistics (N of each group, mean, standard deviation, max, label)
Correlations between variables
proc CORR code
proc corr data = work.setName;
var age height;
run;
code to create new dataset
data work.newSet;
set oldSet;
run;
create new dataset and add new variable and fill it (code)
data work.clenedSet; set oldSet; bp = .; IF x = 6 THEN bp = 1; IF x = 1 OR x = 2 OR x = 3 OR x = 4 OR x = 5 THEN bp = 0; run;
what does cross-tabulation with the FREQ procedure do?
shows two tables: one way freq and cross tabulations of two variables
can see who used what treatment
percentages
frequency tables for variables in analysis
code to show frequencies of dataset proc FREQ
proc freq data = setName;
tables age age*weight;
run;
what to add to FREQ procedure to see how many missing values
tables age age*weight/MISSING;
proc TTEST code
proc ttest data = setName; class group; (groups we want to compare) var height; (compare groups on this variable) run;
what does proc TTEST do to missing values
excludes them
proc TTEST equality of variance results
if Folded F >0.05 assume equal variances, else say variances unequal
what test to use when unequal variances for proc TTEST
Satterthwaite
What test to use when equal variances TTEST
Pooled
proc TTEST if P
Reject null and say difference in heigh between groups
proc TTEST F-test null and alternative
Null is equal variances, alternative is unequal variances
How to use Cochran with proc TTEST
proc ttest data = setName COCHRAN;
When to use cochran
produces p-value for unequal variances
if folded f
How to compare our mean height to mean value under the null of 60 (code)
proc ttest data setName H0=60;
var height;
run;
how to check normality of data
proc univariate data = work.setName plot;
var height;
histogram height;
run;
shows box plot, histogram, etc
how to do before and after TTEST
proc ttest data = setName;
paired before*after
run;
null is before-after=0
ANOVA code
proc anova data = work.setName; class food; (7 different groups ate diff food) model height = food; (compare heights of people who ate different food) run;