BookmarkSubscribeRSS Feed
Allan_dk
Quartz | Level 8

I have some data where the mean (average) will give the wrong impression of the data, because of some few high values. Instead I will like to calculate the median.

How can I do that and display it in a crosstab?


1 REPLY 1
mariusg
Obsidian | Level 7

Hey Allan,

normally we use a simple boxplot to calculate the median and other numbers.

I don`t really have a solution to calculate the median on the fly within a crosstab, like avg,min, max etc.

But maybe this will be an acceptable workaround for you?

1. Build a Data Query with simple proc sql

........

.......

proc sql noprint;

  create view TEMP_LASR_VIEW_0 as

    SELECT

        CARS5.Type length=6 format=$6. AS Type,

        median(CARS5.Horsepower) length=8 format=BEST12. AS Horsepower

    FROM

        LASRLIB.CARS5 CARS5

   GROUP BY

       Type ;

.......

......

(Or use proc means with output out=...)

2. Use the table in your report

Bildschirmfoto 2014-06-06 um 09.49.56.png

Performance will maybe be a problem.

You have to type median into the expression field, because in the default functionlist there isn`t median.

kind regards

Marius

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1772 views
  • 0 likes
  • 2 in conversation