Hello,
I created two macro variables using proc sql select into. My expectation is that I will get two numbers and then continue to next step. The part of my is below:
proc sql noprint;
select min(mean),max(mean)
INTO :mini,
:maxes
from plot1;
quit;
%LET low=%eval(&mini-10);
%LET upper=%eval(&maxes+10);
The error messages are:
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric
operand is required. The condition was: 290.6-10
ERROR: The macro PLOT will stop executing.
I know one way to use input function in data step but not sure how to achieve my goal in this situation.
Any suggestions are welcome and thanks for all.
%eval is only good for integers. replace it with %sysevalf().
%eval is only good for integers. replace it with %sysevalf().
Yes, that's it!
Thank you!
How about
select (min(mean) -10),(max(mean)+10) into : low , :upper
and avoid the extra step?
Of course if you also need mini and maxes that's not needed.
That's really a good idea. Though I still need the %sysevalf function to convert it into numeric.
Why put the numbers into macro variables at all? What is your "next step"?
I need to plot thousands of pics. Those two numbers are the upper and lower bound of axes.
For axis scaling I would look at the IML routine GSCALE. I it takes min and max values and produces nice tick marks using some criteria that you can adjust, like Number of Ticks.
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.