New Contributor
Posts: 2

# Finding Min and Max values from Row

I have a simple prog to solve. I need to find the min and max values for a data set. Need to find min and max values of Names for all the 12 months. I am struggling to get right syntax command.

 Name Jan_15 Feb_15 Mar_15 Apr_15 May_15 Jun_15 Jul_15 Aug_15 Sep_15 Oct_15 Nov_15 Dec_15 Jan_16 Feb_16 Alfred 84 70 48 42 61 20 23 37 34 76 26 20 66 75 Alice 15 18 33 12 49 63 82 44 19 41 33 41 82 57 Barbara 72 9 31 69 50 95 19 86 16 52 71 70 38 22 Carol 82 56 26 80 72 25 19 14 48 73 27 22 48 75
Super User
Posts: 23,724

## Re: Finding Min and Max values from Row

Use the min/max function in a data step.

You say 12 months but don't indicate what time period that actually is, as you have 14,months of data shown.

Clarify your output requirements if you can't figure out the 12 month portion.

``````Data want;
Set have;
Min_12=min(of mar_15--feb_16);

Run;``````
Super User
Posts: 23,724

## Re: Finding Min and Max values from Row

Use the min/max function in a data step.

You say 12 months but don't indicate what time period that actually is, as you have 14,months of data shown.

Clarify your output requirements if you can't figure out the 12 month portion.

``````Data want;
Set have;
Min_12=min(of mar_15--feb_16);

Run;``````
New Contributor
Posts: 2

## Re: Finding Min and Max values from Row

Hi, thanks for the response. What I need is a Min and Max of 14 months
only. Like Min and max of all the values for the Alfred

attachments. -##
Super User
Posts: 23,724

## Re: Finding Min and Max values from Row

Change the variables in the function to refer from start of the list to end.

The notation is

function(of start_variable -- end_variable);

which includes all variables in between the two in your function.

Or you can list out the variables.

min(var1, var2, var3, ... varN);

Documentation on variable lists can be found here:

http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#p0wphcpsfgx6o7n1sjtq...

Super User
Posts: 5,878