Skip to content

Commit 6b71fd4

Browse files
authored
Add files via upload
1 parent db0d6c2 commit 6b71fd4

31 files changed

+779
-0
lines changed

BIOSTATS_HW2.docx

102 KB
Binary file not shown.

Epid602_HW1.docx

35.8 KB
Binary file not shown.

HW3.docx.pdf

443 KB
Binary file not shown.

Homework3.docx

68.5 KB
Binary file not shown.

Lab 4 F17.docx.gdoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"url": "https://docs.google.com/open?id=1EPoIDCCEo8Fd_A0oLeEwKw2hrjRdCUX5G_T-NWAMM0w", "doc_id": "1EPoIDCCEo8Fd_A0oLeEwKw2hrjRdCUX5G_T-NWAMM0w", "email": "[email protected]", "resource_id": "document:1EPoIDCCEo8Fd_A0oLeEwKw2hrjRdCUX5G_T-NWAMM0w"}

Lab 9-Debugging.gdoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"url": "https://docs.google.com/open?id=1Taz8Ns-ZcgLkUurCxwsMfXXyLfS_zcZFEz2m50vkgYk", "doc_id": "1Taz8Ns-ZcgLkUurCxwsMfXXyLfS_zcZFEz2m50vkgYk", "email": "[email protected]", "resource_id": "document:1Taz8Ns-ZcgLkUurCxwsMfXXyLfS_zcZFEz2m50vkgYk"}

Lab0_getting started.sas

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/****************************************************************************************************************************/
2+
/********************************************** EPID642 Sampling and Power **************************************************/
3+
/************************************************** Lab 0: Getting started *************************************************/
4+
/***************************************************************************************************************************/
5+
libname lab0 'C:\Users\ning\Desktop\class materials\labs';
6+
*Reading in comma separated values;
7+
DATA nhanes;
8+
INFILE 'C:\Users\ning\Desktop\class materials\labs\lab0.csv' DLM=',';
9+
INPUT seqn gender ridageyr bmxbmi bmxwaist LBXGLU diabetes TSUGR;
10+
RUN;
11+
12+
DATA lab0.nhanes;
13+
SET nhanes;
14+
RUN;
15+
16+
*Question 2: mean(std) total sugar intake by diabetes;
17+
PROC MEANS DATA=lab0.nhanes;
18+
VAR tsugr;
19+
CLASS diabetes;
20+
RUN;
21+
22+
*Question 3: diabetes status by gender;
23+
PROC FREQ DATA=lab0.nhanes;
24+
TABLES diabetes*gender;
25+
RUN;
26+
27+
*Question 4: the proportion of the pre-obese and the obese;
28+
*Create obesity classification by BMI;
29+
DATA lab0.nhanes;
30+
SET lab0.nhanes;
31+
IF bmxbmi ne . and bmxbmi<25 THEN obesity=0;
32+
IF bmxbmi >=25 and bmxbmi<30 THEN obesity=1;
33+
IF bmxbmi >=30 THEN obesity=2;
34+
RUN;
35+
36+
PROC FREQ DATA=lab0.nhanes;
37+
TABLES obesity;
38+
RUN;
39+

Lab1-reviewV2.sas

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
/*------------------------------------------------------------------------------
2+
Filename: review.sas
3+
-------------------------------------------------------------------------------;
4+
*------------------------------------------------------------------------------;
5+
* Example 1 ;
6+
*------------------------------------------------------------------------------;
7+
/* Reading hand entered data into SAS */
8+
data DetroitWeight;
9+
input weight @@;
10+
/* The trailing at signs (@@) enable the procedure to read more than
11+
one observation per line. */
12+
datalines;
13+
157.7556 209.9111 136.5778 115.9111 136.8445 169.3333 168.8445 145.6667 199.8445
14+
168.8445 137.6 105.8444 169.0889 157 125.7556 181.9333 155.7333 130.0222
15+
268.8889 135.8222 157.4889 196.0667 147.6667 137.6
16+
147.6667 152.2 196.0667 154.4667 173.1333 140.1111
17+
140.1111 183.9556 189.7556 126.7556 103.0667 179.6667 163.8
18+
179.6667 163.8 107.8667 185.4667 113.9111 139.8667 168.5778
19+
201.8445 113.9111 305.4222 116.1778 170.3556 116.1778
20+
;
21+
run;
22+
/* Requesting univariate statistics and histogram for variable weight */
23+
proc univariate data=DetroitWeight plot;
24+
var weight;
25+
histogram;
26+
title "Histogram for weight (Continuous Variable)";
27+
run;
28+
29+
/* One-sample t-test */
30+
proc ttest h0=175 alpha=0.05;
31+
var weight;
32+
title 'One-Sample t Test';
33+
run;
34+
35+
36+
*------------------------------------------------------------------------------;
37+
* Example 2 ;
38+
*------------------------------------------------------------------------------;
39+
/* Below step assumes that you have a copy of file "smoke.xls"
40+
in a directory called "M:\Biostats 522". This is specified in the line
41+
that begins with DATAFILE. I've also included a couple more examples showing
42+
how the DATAFILE line can be written if you had the data saved in either afs
43+
server or somewhere in your own C drive. So if you choose to work with
44+
another directory such as your flashdrive, change the "DATAFILE" line below
45+
to specify that entire path.
46+
47+
Get help from your GSI if you don't know how to create a folder
48+
and save the files from canvas to that folder. */
49+
50+
/* Note that the first set of commands (from PROC IMPORT to RUN) can also be
51+
done by choosing "File -> Import Data" from SAS's menu tabs.
52+
The SAS commands behind "File -> Import Data"
53+
are basically made of below set of "proc import" command
54+
details of which you do not really have to learn. */
55+
56+
/* Import smoke.xls and save the data as smoke. */
57+
PROC IMPORT OUT= WORK.smoke
58+
/* datafile = "/afs/umich.edu/user/m/y/myrakim/class/bios522-W18/Datasets/smoke.xls" */
59+
datafile = "c:\class\0bios522-W18\Datasets\smoke.xls"
60+
/* datafile= "M:\Biostats 522\smoke.xlsx" */
61+
DBMS=EXCELCS REPLACE;
62+
RANGE="Sheet1$";
63+
SCANTEXT=YES;
64+
USEDATE=YES;
65+
SCANTIME=YES;
66+
RUN;
67+
68+
69+
/* List smoke Data:
70+
always list at least part of the data & check if they look good. */
71+
proc print; run;
72+
73+
/* Univariate Descriptive Statistics of all variables in smoke data */
74+
proc means data=smoke;
75+
title "Descriptive Statistics";
76+
run;
77+
78+
/* Create a Dichotomous Variable, then Save the Data as smoke2. */
79+
data smoke2; set smoke;
80+
if b<100 then lbw=1;
81+
else if b>=100 then lbw=0;
82+
run;
83+
84+
/* Univariate Descriptive Statistics using dataset smoke2 */
85+
/* Note that "var A S B;" or "var lbw;" line is optional, and excluding this line */
86+
/* means you are requesting descriptive stats for all variables in the dataset. */
87+
/* If only "var lbw" is given, descriptive stats will be limited to lbw only. */
88+
proc means data=smoke2;
89+
title "Descriptive Statistics";
90+
title2 "A=age, S=smoke, B=Weight, lbw=low birth weight (1/0)";
91+
var A S B;
92+
var lbw;
93+
run;
94+
95+
/* Requesting the contents of the dataset such as variable names */
96+
proc contents data=smoke2;
97+
title "Contents of SAS Data Set";
98+
run;
99+
100+
/* Formating Statement: Effort to explain what the values of
101+
1 and 0 for lbw variable represent. The format is named lbwfmt. */
102+
proc format;
103+
value lbwfmt 1="1:Less than 100 oz" 0="0:>= 100 oz";
104+
run;
105+
106+
/* Requesting Frequency Table for Variable lbw */
107+
proc freq data=smoke2;
108+
tables lbw;
109+
format lbw lbwfmt.;
110+
title "Frequencies for Categorical Variables";
111+
run;
112+
113+
/* Requesting charts - simple visualization */
114+
proc chart data=smoke2;
115+
hbar lbw / discrete;
116+
title "Bar Charts for Categorical Variables";
117+
run;
118+
119+
/* Requesting univariate statistics and histogram for variables A and S */
120+
proc univariate data=smoke2 plot;
121+
var A S;
122+
histogram;
123+
title "Histogram for Continuous Variables";
124+
run;
125+
126+
*------------------------------------------------------------------------------;
127+
* Example 3 ;
128+
*------------------------------------------------------------------------------;
129+
/*
130+
* There are many ways to use menu drive ways of SAS - like SPSS.
131+
* For this course, I don't think these will be helpful. But they can
132+
* be useful when you cannot remember the SAS command for some simple analysis.
133+
*
134+
* Under Solutions tab, you will see ASSIST. Similarly under Solutions, you will
135+
* see Analysis, under which you will see Interactive Data Analysis.
136+
* ASSIST and Interactive Data Analysis provide ways to do menu driven SAS.
137+
* For each these, you will need to first load the SAS data by finding where the
138+
* dataset is located using Explorer within SAS.
139+
*
140+
* Another way to do this is by clicking either a SAS dataset or SAS program file.
141+
* For example, under Review module, you will see a dataset named "smoke.sas7bdat".
142+
* If you download this file to your working folder and double click the file,
143+
* you will have SAS Enterprise Guide open. Under SAS Enterprise Guide,
144+
* you will be able to do various analyses in menu-driven way by looking
145+
* under Tasks tab. You can similarly double click this file (review.sas)
146+
* which will open SAS Enterprise Guide.
147+
*/
148+

Lab1.docx.gdoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"url": "https://docs.google.com/open?id=182GDq6D-jr2OwcyJWUeBh7UX0hPXS4LeQwbLuVsGpkU", "doc_id": "182GDq6D-jr2OwcyJWUeBh7UX0hPXS4LeQwbLuVsGpkU", "email": "[email protected]", "resource_id": "document:182GDq6D-jr2OwcyJWUeBh7UX0hPXS4LeQwbLuVsGpkU"}

Lab2-SLR.sas

23.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)