You would have to show the LOG for your FCMP code to see why it may not work. Does your log show text similar to this after Proc FCMP ?
NOTE: Function Tier saved to work.functions.newfuncs.
NOTE: PROCEDURE FCMP used (Total process time):
real time 0.05 seconds
cpu time 0.03 seconds
When I use your function with a small data set compiled locally it runs okay.
I did see a character between the end of Proc FCMP and the Options statement that SAS didn't like so check your log. If there are more that made it into your code that could be an issue. Also, it is a good idea to paste code or log text into a text box opened on the forum with the </> that appears above the message window. The main message windows on the forum will reformat text, especially white space characters, and may result in code that doesn't run.
What your function is doing is more typically done with a custom FORMAT in SAS than a function. Formats are look ups but restricted to single variable/ value
Proc format;
value mpg_tier
low - <20 = 'Low'
20 - < 30 = 'Median'
30 - High = 'High'
;
run;
/* use without creating new variable*/
Proc print data=work.cars1;
var mpg_average;
format mpg_average mpg_tier. ;
run;
/* or create a new variable with PUT function and the format*/
data work.cars2;
set work.cars1;
mpg_quality2 = put(mpg_average, mpg_tier.);
run;
There are very limited transforms that could be done with Format code. A function would be more appropriate for something using 2 or more variables or a more complex calculation or changing calculation based on range of values.