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