程序代写代做 database PSTAT 130 – SAS Programming

PSTAT 130 – SAS Programming
Homework 8 3
Claire Mouminoux – clairemouminoux@pstat.ucsb.edu
Objectives
• Manipulating data and using SAS function • DoingloopsinDATAstep
Exercise
Download the SAS data file CA_temp_irvive on Gauchospace. Put it in a folder on your computer (or a folder on the server if using SAS studio). Link this folder to SAS library using a LIBNAME statement. This dataset contains three variables correspond- ing to the date, the maximal and minimal temperature recorded by the Irvine Meteo station since 1987 to 2020.
1. Compute the average between temperature min and max for each row in a new variable temp, we will now suppose that is is the best way to have an estimation of the average temperature for a given day.
2. Extract the year, day and month of each date in new variables years, age, month.
3. Create a database temp_march which keep only the temperature of March.
4. Plot an histogram of the variable temp using Proc SGPLOT in temp_march.
5. Using the form of the distribution of the past data, we now assume that the aver- age temperature in march follows a normal distribution. Using the proc means procedure, compute the average and standard deviation of this distribution as well as the minimum value and maximum value.
6. We want now to plot the probability distribution function and the cumulative distribution function of the normal distribution having the same mean and stan- dard deviation that our samples using a monte-carlo simulation.
• Using a loop in a data statement, generate a database PDFNORMAL includ- ing to column : value (corresponding to all value between the min and the max with a lag of 0.5 and PDF corresponding to the PDF value of the normal distribution on each point.
• Using Proc SGPLOT and generated data, plot this PDF.
• Reiterate this exercice but this time by computing the Cumulative distribu- tion function.