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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Haikuo
Onyx | Level 15

%eval is only good for integers. replace it with %sysevalf().

View solution in original post

7 REPLIES 7
Haikuo
Onyx | Level 15

%eval is only good for integers. replace it with %sysevalf().

Amy_W
Calcite | Level 5

Yes, that's it!

Thank you!

ballardw
Super User

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.

Amy_W
Calcite | Level 5

That's really a good idea. Though I still need the %sysevalf function to convert it into numeric.

data_null__
Jade | Level 19

Why put the numbers into macro variables at all?  What is your "next step"?

Amy_W
Calcite | Level 5

I need to plot thousands of pics. Those two numbers are the upper and lower bound of axes.

data_null__
Jade | Level 19

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.

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
  • 7 replies
  • 1457 views
  • 3 likes
  • 4 in conversation