BookmarkSubscribeRSS Feed
Dick_Shryock
Calcite | Level 5

  

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
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12

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

Reeza
Super User

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?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 758 views
  • 0 likes
  • 3 in conversation