BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

Dear All,

I have a Dataset

x

  1
  3
  2
  6
  4
  8
  7
  1
  9

Usingn this Dataset, would like to get the smallest,largest, Mean and Median values in a single program. Is it possible ?

Syntaxes for all as below:

Smallest - MIN(argument,argument, ...)

Largest - MAX(argument,argument, ...)
Mean    - MEAN(argument,argument, ...)
MEDIAN(value1<, value2, ...>)

Regards,

S Ravuri.

1 ACCEPTED SOLUTION

Accepted Solutions
MichelleHomes
Meteorite | Level 14

Hi,

Have you looked at using PROC MEANS? You can create a table and a report with the results if you like... general syntax you would need is as follows:

data dataset_name;

input x;

cards;

1

3

2

6

4

8

7

1

9

;

run;

*To only produce a report;

proc means data=dataset_name min max mean median;

    var x;

run;

*To produce a report and a table that contains the statistics;

proc means data=dataset_name min max mean median;

    var x;

    output out=summaryStatistics min=Smallest max=Largest mean=Mean mean=Median;

run;

For more details check out http://support.sas.com/documentation/cdl/en/proc/63079/HTML/default/viewer.htm#p0f0fjpjeuco4gn1ri963...

Cheers,

Michelle

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com

View solution in original post

2 REPLIES 2
MichelleHomes
Meteorite | Level 14

Hi,

Have you looked at using PROC MEANS? You can create a table and a report with the results if you like... general syntax you would need is as follows:

data dataset_name;

input x;

cards;

1

3

2

6

4

8

7

1

9

;

run;

*To only produce a report;

proc means data=dataset_name min max mean median;

    var x;

run;

*To produce a report and a table that contains the statistics;

proc means data=dataset_name min max mean median;

    var x;

    output out=summaryStatistics min=Smallest max=Largest mean=Mean mean=Median;

run;

For more details check out http://support.sas.com/documentation/cdl/en/proc/63079/HTML/default/viewer.htm#p0f0fjpjeuco4gn1ri963...

Cheers,

Michelle

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com
sambasiva_ravuri_tcs_com
Calcite | Level 5

OOPS....I forgot about this PROC. Million Thanks to  Michelle.

Regards,

S Ravuri.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1462 views
  • 0 likes
  • 2 in conversation