Chapter#16: (Summarizing Your Data)
In this chapter I am going to the use of proc means and proc summary to generate summary reports. Summary consists several statistics part like sum and means of numeric variables. However, these procedures are much more versatile and can be used to create summary
data sets that can then be analysed with more data or proc steps.
Chapter#16 and Problem#1:
Using the SAS data set College, compute the mean, median, minimum, and
maximum and the number of both missing and non-missing values for the variables
ClassRank and GPA. Report the statistics to two decimal places.
Solution:
Result:
Learning:
1# I have used title statement that gives the title for the output
2# how to use proc means to generate reports
3# I have used to variable that is ClassRank and GPA
4# for the customization I have used N and N miss
5# in code I used maxdec=2 that shows the values goes upto two decimal point
Chapter#16 and Problem #3
Using the SAS data set College, report the mean and median GPA and ClassRank
broken down by school size (SchoolSize). Do this twice, once using a BY statement,
and once using a CLASS statement.
Solution:
Result:
Learning:
1# when we want to see descriptive statistics for each level of another variable then we use by statement.
2# when we use this first of all we have to sort the data set by the same variable or variables you list in by statement
3# here i sorted the data set by school size thats why you can see in result display output by Missing, Small, Large school size.
4# the same thing i have done with the use of class statement that shows the same result
Chapter#16 and Problem#5
Using the SAS data set College, report the mean GPA for the following categories of
ClassRank: 0–50 = bottom half, 51–74 = 3rd quartile, and 75 to 100 = top
quarter. Do this by creating an appropriate format. Do not use a DATA step.
Solution:
Result:
Learning:
1# One very nice feature of using a CLASS statement (besides not having to sort your data)is that SAS uses formatted values of the CLASS variable(s).
2# Here I have used proc format statement to the procedure and changing how the class variable groups your data.
3# Like here I have used for Bottom Half, Third Quartile and Top Quartile and formatting is done on the basis of ClassRank.
No comments:
Post a Comment