BookmarkSubscribeRSS Feed
murthyaug170
Calcite | Level 5

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.

 

NameJan_15Feb_15Mar_15Apr_15May_15Jun_15Jul_15Aug_15Sep_15Oct_15Nov_15Dec_15Jan_16Feb_16
Alfred8470484261202337347626206675
Alice1518331249638244194133418257
Barbara729316950951986165271703822
Carol8256268072251914487327224875
5 REPLIES 5
Reeza
Super User

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;
Reeza
Super User

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;
murthyaug170
Calcite | Level 5
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

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Reeza
Super User

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...

 

 

LinusH
Tourmaline | Level 20

By having data stored in a wide "excel-like" format, you make your queries syntax driven.

As opposed to storing in a long, normalised format, where you usually can act on columns values instead - a more data driven approach.

Data never sleeps

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 5 replies
  • 11473 views
  • 2 likes
  • 3 in conversation