Math 338
Kafai HW 2
Fall 2010
Due 10/08/2010
Name
1. Study Proc Tabulate and other presentation Procs
2. Input the following data into a data set called simpson
alaska
alaska
alaska
alaska
alaska
alaska
alaska
alaska
alaska
alaska
amwest
amwest
amwest
amw
Math 338
Kafai Final 1
Fall 2010
Due 12/20/2010 (Before noon)
Name
Describe with full sentences and in a concise manner all the topics you have learned (covered) in
Math 338 this semester.
Example:
Input statement in a SAS data step:
Input statement is us
Math 338
Kafai HW 1
Fall 2010
Due 9/27/2010
Name
1. Write a SAS program called HW1.sas to create a permanent SAS data file using StateData.txt
data file with the following variables:
State, Region, Visits, Salesman, Sale, Expenses
Use comments and titles
Math 338
Kafai HW 6
Fall 2010
Due 11/8/2010
Name
Data set EMPLOY contains:
ID (employee number),
GENDER, and
DOB (date of birth).
Data set PARTS contains:
PART_NO and
PRICE.
Data set SALES contains:
ID (employee number),
TRANS (transaction number),
PART_N
Math 338
Kafai HW 3
Fall 2010
Due 11/01/2010
Name
1. Generate 225 samples of size 10000 random numbers from U(0, 1). For each of these 225
samples calculate the mean.
A.
B.
C.
D.
Find the simulated probability that the mean is between 0.49 and 0.50 inclus
Part A
SAS Code
libname datain 'D:\MATH 338\DATA';
data datain.HW1;
length state $35.0 region $ 10.0;
infile 'D:\MATH 338\DATA\statedata.txt';
input state $& region $visits salesman sale expenses;
label state='State Name'
region='Region Assignment'
visits
Tentative Syllabus
Math 338
Introduction to SAS
Dr. Mohammad R. Kafai
Office
Office Hours
Email
TH 924
10:00 - 11:00 MWF and by appointment
kafai@math.sfsu.edu
Text Book: SAS Application Programming by Frank C. DiIorio and online SAS manual
Grade is based
Math 338
Kafai HW 11
Fall 2010
Due 12/13/2010
Name
Import the file HW11.xls. The variables in this file are:
Students First Name
Students Last Name
Q1 Q9 (Quizzes 10 points each) Drop the lowest two and calculate a percentage
H1 H14 (Homework 10 points ea
Math 338
Kafai HW 8
Fall 2010
Due 11/19/2010
Name
A survey is conducted and data are collected and coded. The data layout is shown below:
Variable
ID
GENDER
PARTY
Description
Subject identifier
VOTE
Did you vote in the
last election?
Do you agree with
the
Math 338
Kafai HW 7
Fall 2010
Due 11/17/2010
Name
We have three data sets, ONE, TWO, and THREE. Each data set contains the variables:
ID (IDNUM in data set TWO)
SEX
DOB
SALARY
In addition, data set TWO contains TAXRATE and WITHHOLD; data set THREE contain
Math 338
Kafai HW 5
Fall 2010
Due 11/1/2010
A one unit stick is broken randomly into two pieces.
1) Find E (the short piece divided by the long piece).
2) Find E (the long piece divided by the short piece).
Name
Math 338
Kafai HW 4
Fall 2010
Due 11/1/2009
Suppose Xi for i=1, 2, 3 has uniform (0, 1) distribution.
1. Let M = min (n: X1 + X2 + + Xn> 1). Find E (M) by simulation.
2. Let N = min (n: Xn > Xn+1). Find E (N) by simulation.
Name
1.
SAS Code:
data A;
meanx=0;
do j=1 to 225;
sumx=0;
do i = 1 to 625;
u = rand("Uniform");
x=10+(22-10)*u;
sumx=sumx+x;
end;
meanx=sumx/625;
output;
end;
run;
proc freq;
tables meanx;
run;
proc univariate;
var meanx;
histogram meanx;
run;
Output:
a)
The S