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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 653 views
  • 3 likes
  • 3 in conversation