![]() ![]() See how in the blog post Save Statistics In Macro Variables.įinally, you can download the entire code from this post here. You can usually do everything you need to do in one invocation of the procedure. When you have calculated descriptive statistics, it is often convenient to save them for later use. PROC MEANS several times to create different output data sets. 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. PROC MEANS and PROC UNIVARIATE are perfect if you want to know other statistics as well. Depending on your knowledge and SAS skills, you can use one of them. ![]() This post demonstrated how to generate simple descriptive statistical sizes in SAS. Basically, there are 3 ways to calculate the median in SAS, namely with PROC MEANS, PROC UNIVARIATE, and PROC SQL. 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. Looking to analyze your data with Proc Means but don’t know how to start No worries. 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 |