



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




HW assignment # written by: Greg Distler date: 9/17/ file name and path: E:\STAT 502\HW3 Greg Distler\homework3.sas data taken from http://lib.stat.cmu.edu/datasets/backache this data was accessed on 9/6/07 and preprocessed: '.&' was removed from all lines data was then saved in notepad: E:\STAT 502\HW3 Greg Distler
backpain.txt Purpose: The purpose of this prgm is to explore the ODS output system VARIABLES Inputted: patnum = patient's number painsev = pain severity (values: 0=NILL; 1="nothing worth troubling about"; 2="troublesome but not severe"; 3="severe") month = month when pregnancy pain started age = age of patient in years height = height in meters startwt = weight at start of prgncy endwt = weight at end of prgncy babywt = weight of baby prevpregs = number of previous pregnancies prevache = backache with previous prgncy (values: 1=not applicable; 2=NO; 3=YES; 4=SEVERE) factors relieving backache (8 separate indicator variables with 0=no; 1=yes) tablets = tablets (aspirin) watbot = hot water bottle bath = hot bath cushion = cushion behind back in chair standrel = standing up sitrel = sitting down
lyingrel = lying down walkrel = walking factors aggravating pain (15 separate variables with 0=no; 1=yes) fatigue = fatigue bending = bending lifting = lifting makebed = making up beds washup = washing up iron = ironing bowels = a bowel action intcrs = intercourse cough = coughing sneeze = sneezing turnbed = turning in bed standagg = standing up sitagg = sitting down lyingagg = lying down walkagg = walking Variables calculated in the pgm: BMI = body mass index = startwt/(height^2) indchild = indicator variable if woman has a child from previous prgncy (=1 if they do not; =0 if they do) DescriptBMI = a description of what the BMI means if it falls in the certain rage (based on http://www.halls.md/ideal-weight/medical.htm) (accessed 31 aug 07) The following format variables were also created: BackPain, BackPainPrev, and FormatIND; They were used to format indicator variables */ OPTIONS nodate formdlim='-'; *input the data; DATA backache; INFILE 'E:\STAT 502\HW3 Greg Distler\backpain.txt'; input patnum painsev month age height startwt endwt babywt prevpregs prevache tablets watbot bath cushion standrel sitrel lyingrel walkrel fatigue bending lifting makebed washup iron bowels intcrs cough sneeze turnbed standagg sitagg lyingagg walkagg; *simply defines an indicator variable if the woman has a child from a previous preg; if prevpregs> 0 then indchild = 0 ; else indchild = 1 ; compute BMI; BMI = startwt/(heightheight); *the following lines add a description to BMI; if BMI <= 19.2 then DescriptBMI = 'underweight';
this procedure answers question 2 and generates the desired plots for html output; ODS HTML file="E:\STAT 502\HW3 Greg Distler\prob2.html"; PROC plot data = backache vpercent= 50 hpercent= 50 ; this generates the four plots on same page; title 'baby weight vs age, height, start weight, and month pain started'; plot babywtage; plot babywtstartwt; plot babywtheight; plot babywtmonth; run ; PROC sort data = backache out=BMIsort;by painsev BMI; run ; PROC boxplot data = BMIsort; title 'BMI Measurements vs Back Pain Severity'; plot BMIpainsev; run ; ODS HTML CLOSE; continue with problem 2 but do the pdf output; ODS PDF file = "E:\STAT 502\HW3 Greg Distler\prob2.pdf"; PROC plot data = backache vpercent= 50 hpercent= 50 ; title 'baby weight vs age, height, start weight, and month pain started'; plot babywtage; plot babywtstartwt; plot babywtheight; plot babywtmonth; run ; PROC sort data = backache out=BMIsort;by painsev BMI; run ; PROC boxplot data = BMIsort; title 'BMI Measurements vs Back Pain Severity'; plot BMI*painsev; run ; ODS PDF close;
Homework set 3, problem 3 file name and path: E:\STAT 502\HW3 Greg Distler\hw3 problem3.sas written by: Greg Distler Goal: to input data on muscle mass and age, create univariate statistics about the data, produce a plot of muscle mass vs age, and output everything to an html webpage Variables: MMass = inputed muscle mass Age = persons age Data sets: calls in a text file from E:\STAT 502\HW1\AgeMuscleMassAug27.txt */ OPTIONS formdlim="-" pageno= 1 ; *input muscle mass data from txt file; DATA MuscleAge; INFILE 'E:\STAT 502\HW3 Greg Distler\AgeMuscleMassAug27.txt'; input MMass Age; *print out the input data; proc print ; title 'Muslce Mass and Age'; run ; this ouputs the univariate data and plot to a webpage with a table of contents; ODS HTML path="E:\STAT 502\HW3 Greg Distler" body = "problem3.html" / Output objects / contents = "problem3TOC.html" / Table of contents / frame = "problem3frame.html"; / organizes display */ *determine the univariate statistics; proc univariate ; var MMass Age; run ; plot muscle mass as a function of age; proc plot ; plot MMassAge; run ; ODS HTML CLOSE;