BookmarkSubscribeRSS Feed
kwyland1
Fluorite | Level 6

Others have posted here about why certain function names don't work.  It is suggested you can't use a reserved name.

The solution to one problem was posted as 'Well I don't know why' - just use a different function name.

I get that.  Like the sample below, 'convert' does not work but _convert would. 

But I would like some reference to know what the naming rules are.  I've searched for days - any help appreciated.

 

Example:

%let outlib = work;
* Example 2: Return a Character Value;
proc fcmp outlib=&outlib..functions.conversions;
*function lb2kgC(lb) $;   *--this works;
function convert(lb) $;  *-- this does NOT work;
length kg $10;
kg = catt(put((lb/2.2),6.2),'Kg');
return (kg);
endsub;
run;
4 REPLIES 4
sbxkoenk
SAS Super FREQ
  • Don't use the name of a procedure.
  • Don't use the name of a statement (PROC EXPAND has a CONVERT statement).
  • Don't use this list of reserved words (it's for the macro facility, but I would say it's just safe to avoid these reserved words everywhere).
  • Don't start function name with a number
  • No special characters and no spaces

Koen

kwyland1
Fluorite | Level 6

I think I will shoot my code to TS.  The reserved words list for Macros doesn't have the one I tried which is convert.  Also tried conv_.  Bellies up.  If I get a response from TS that anyone could benefit from, I'll post it here.  Thanks.

Reeza
Super User
FYI - if you have a paid SAS license this seems like a good question to ask tech support.
kwyland1
Fluorite | Level 6
I do - was just trying out communities first

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1487 views
  • 3 likes
  • 3 in conversation