Desktop productivity for business analysts and programmers

Trying to calculate various statistic for columns in a table

Reply
Contributor
Posts: 25

Trying to calculate various statistic for columns in a table

  

Trying to calculate various statistic for columns in a table

This question is Not Answered.

Dick.Shryock Newbie

<:section class="j-original-message"> 

Currently Being Moderated

 

I have a table with 11 columns and 31 rows the first column is a description and the rest of the columns represent various counts for each description.

What I want to do in SAS is create a table that provides the following for columns 2 - 11:

Sum

Median

Mean

Max

This is really easy to do in excel but I can't seem to figure how to do it in SAS [Version EG.5.1 (5.100.0.12019) (32-bit)]

See attached Dataset .

Thanks, Dick Shryock

Sample Output Table with Column Sum and Statistics

Date AdmitObsAMAD/CLWBSTranxLBECLDExpiredDay_Total
01/01/2013440113001100177
01/02/2013440012403000171
01/03/2013410015623000202
Total1290141027100550
Median44.00.00.0130.00.03.00.00.00.0177
Mean43.00.0.03136.70.72.30.30.00.0183
Max44011562.3100202
Attachment
Valued Guide
Posts: 2,111

Re: Trying to calculate various statistic for columns in a table

Dick,

To get the statistics is quite easy, to add them back to the data table is messy.

To get the statistics, use tasks --> describe --> summary statistics

and select the variables and statistics that you want.  It will produce an output report with the data.

If you want to add them to the data table, you can also select output results and it will also produce a SAS dataset with one record containing all the summary statistics for all the variables.  Then you need to rename the variables, transpose the data, and append the result to the original.

Doc Muhlbaier

Duke

Grand Advisor
Posts: 17,332

Re: Trying to calculate various statistic for columns in a table

That format is going to be hard in EG, not impossible, just difficult I think. Partly I have 4.2 to test on so it may be easier in 5.1.

You ok doing code or would you rather do point and click?

Ask a Question
Discussion stats
  • 2 replies
  • 187 views
  • 0 likes
  • 3 in conversation