DATA Step, Macro, Functions and more

ERROR "function LENGHTC unknown" -- (trying to return lenght of a string)

Reply
New Contributor F_S
New Contributor
Posts: 2

ERROR "function LENGHTC unknown" -- (trying to return lenght of a string)

Hi,

 

SAS gives me the following error: The function LENGHTC is unknown, or cannot be accessed.

This occurs after I give the following commands:

 

 

data b;
text="a ba ckjp";
lenght_text=lenghtc(text);
run;

I check this document but I may have missed some steps... http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002283942.htm

 

 

 

Thanks to all for any tip. 

 

Best regards,

fbs

Super User
Posts: 7,809

Re: ERROR "function LENGHTC unknown" -- (trying to return lenght of a string)

Look again. The function is called LENGTHC, not LENGHTC (you changed positions of T and H)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,970

Re: ERROR "function LENGHTC unknown" -- (trying to return lenght of a string)

Posted in reply to KurtBremser

Oh for the want of a proper IDE with code completion...

Super User
Posts: 7,809

Re: ERROR "function LENGHTC unknown" -- (trying to return lenght of a string)

SAS should replace the Enhanced Editor with a properly configured port of emacs ...

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 11,343

Re: ERROR "function LENGHTC unknown" -- (trying to return lenght of a string)

Posted in reply to KurtBremser

KurtBremser wrote:

SAS should replace the Enhanced Editor with a properly configured port of emacs ...


 

But what would happen if the Editor tries to correct the spelling but you have a custom defined function of LenghtC? I'm a little leery of programs that try to "help" too much.

Super User
Super User
Posts: 7,970

Re: ERROR "function LENGHTC unknown" -- (trying to return lenght of a string)

It doesn't need to correct your typing so much, but it can provide autocomplete which shows valid options in a list to choose from, here is a snippet from Sharpdevelop:

Capture.PNG

 

Typing len would automatically show a list of functions/types associated with that prefix.  Yes, I know the EE has abbreviations, its really a half hearted attempt though.  Try almost all IDE's (or even text editors) they all have it. Note in the above dataGrid1 is mine, so it automatically assumes thats the most prominent.  

New Contributor F_S
New Contributor
Posts: 2

Re: ERROR "function LENGHTC unknown" -- (trying to return lenght of a string)

Posted in reply to KurtBremser

Thanks a lot! 

Greatly appreciated!

New Contributor
Posts: 3

Re: ERROR "function LENGHTC unknown" -- (trying to return lenght of a string)

@F_S  SAS could not recognise this function due to syntax error, misspelled lengthc (arg),

lenght_text=lenghtc(text);

Please refer the above syntax

Ask a Question
Discussion stats
  • 7 replies
  • 353 views
  • 3 likes
  • 5 in conversation