Both of the above methods will yield the same output data set. Now, let’s print the resulting data set to see what we get. here is the SAS documentation on the CLASS statement scroll down to the bottom to read a paragraph on this topic.here is a discussion on the SAS Support Communities forum on this topic.If you are interested in learning more about the differences between using the “BY” statement and using the “CLASS” statement, This option does not require sorting ahead of time, because I am not using the “BY” statement. Note that I have added the “NWAY” option in the “PROC MEANS” statement to ensure that the overall mean for the entire data set is NOT printed. Update on Wednesday, October 29, 2014: Thanks to a helpful comment below from Guillaume, here is another code to get the same result using the “CLASS” statement. I want to specify that this isn’t just any height, but the mean height, so I declare a new variable name: Mean_Height. You can leave it blank, and it will just use the original variable’s name in the new data set – in our case, “height”. The “mean” option in the “output” statement specifies the name of variable of that contains the mean. There are 2 variables that I don’t want in the new data set: _TYPE_ and _FREQ_, so I drop them while the output data set is created. Since we will categorize the means by gender using the “BY” statement in PROC MEANS, we first need to sort the data by the variable “sex”.
![sas code calculate from linear regression equation sas code calculate from linear regression equation](https://i.ytimg.com/vi/ZyruUhomEnQ/maxresdefault.jpg)
Here is the code to do it using PROC MEANS. Let’s calculate the average height by gender. The SAS Code – 2 Methods Involving PROC MEANS Suppose we want to fit a multiple linear regression model that uses number of hours spent studying and number of prep exams taken to predict the final exam score of students: Exam Score 0 + 1(hours) +2(prep exams) First, we’ll use the following code to create a dataset that contains this information for 20.