By default, PROC MEANS does not display the interquartile range (IQR) as one of the summary statistics but you can use the QRANGE statement to include the IQR in the output: proc means datamydata N Mean QRANGE Std Min Max var points run This particular example. See how in the blog post Save Statistics In Macro Variables.įinally, you can download the entire code from this post here. You can use PROC MEANS to calculate summary statistics for variables in SAS. When you have calculated descriptive statistics, it is often convenient to save them for later use. The obvious alternatives are PROC UNIVARIATE, PROC SUMMARY, and PROC FREQ. Consequently, there are dozens of other options and procedures available. However it depends largely on the problem at hand. My usual go-to procedure for descriptive statistics is PROC MEANS. Only the difference is that PROC MEANS will give. This post demonstrated how to generate simple descriptive statistical sizes in SAS. Let me tell you frankly PROC SUMMARY and PROC MEANS are siblings with all their features commonly inherited. Read all var /* Read variable Height into vector */ close sashelp.class /* Close dataset */ mu0 = 60 /* Hypothesised mean */ N = nrow(Height) /* Number of observations */ min = min(Height) /* Minimum Value */ max = max(Height) /* Maximum Value */ range = max - min /* The difference between min and max */ Mean = 1/n * sum(Height) /* Population mean value */ Std = sqrt(1/(n-1) * sum((Height - Mean)#2)) /* Standard Deviation */ Std_Err = Std / sqrt(n) /* Standard error of the mean */ t_stat = (Mean - mu0) / Std_Err /* T statistic */ p_value = (1-cdf('t',abs(t_stat),n-1))*2 /* P value associated with t-statistic */ print N max min range Mean Std Std_Err t_stat /* Print selected descriptive statistics */ p_value quit Īs you can see from the printed statistics, the values generated are equal to those of the Means Procedure. Use sashelp.class /* Open dataset for reading */
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |