DATA Step, Macro, Functions and more

sas functions

Reply
Super Contributor
Posts: 371

sas functions

Hello,

Please, I would why when we call some sas function (ex: upcase, lowercase, ...) , sas sends an error message, it does not regonize the function.  why ? and how can we  identify the main raison for the matter ? is it a question of package ? 

 

Trusted Advisor
Posts: 1,019

Re: sas functions

Example, with log please.

Super User
Posts: 19,792

Re: sas functions

Because it's not a valid function in the manner you're trying to use it. 

 

SAS functions are upcase and lowcase (low vs lower). SAS SQL allows upper/lower to work to convert case as well, but those won't work in a data step. 

 

FEDSQL has a set of specific functions available.

IML has a different set of functions.

SAS SQL has a few different ones as well. 

If you're using SQL Pass Thru you need to use the native DB functions, ie Oracle or T-SQL.

 

If you try to use an IML function in SAS SQL its not going to work, except there are overlaps. For example up until 9.4 the median function worked in PROC SQL but wasnt' what you expect. 

 

Find the relevant sections of the docs and bookmark them for reference. 

 

 

Super Contributor
Posts: 371

Re: sas functions

@ll: Thank you all.

I think, it can be a question of prfil or sas package ?

So, how can we check , if the function existes ? and why it does not existe ?

Super User
Posts: 19,792

Re: sas functions

Read the documentation. 

Super Contributor
Posts: 371

Re: sas functions

which one ?

Super User
Posts: 7,782

Re: sas functions

Just google sas function functionname.

It's really that easy.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super Contributor
Posts: 371

Re: sas functions

Posted in reply to KurtBremser
Super User
Posts: 11,343

Re: sas functions

Start by running this code:

proc format library=work;
value poorothergrp
0 -<14 ='Top'
14 - 30='Bottom';
run;

Which will give the names of currently available functions and some other info.

 

There may be some that are in the result that aren't generally documented or apply to products that you don't have licensed or only apply to some operating systems

Super Contributor
Posts: 371

Re: sas functions

@ballardw : Thank you

Until now, I do  not know see that  ?, when I use this code

proc format library=work;

value poorothergrp

0 -<14 ='Top'

14 - 30='Bottom';

run;

 

data test;

v=3;

y=max(7,8);

run;

 

proc format

library = work;

select poorothergrp;

run;

Super User
Posts: 11,343

Re: sas functions


LineMoon wrote:

@ballardw : Thank you

Until now, I do  not know see that  ?, when I use this code

proc format library=work;

value poorothergrp

0 -<14 ='Top'

14 - 30='Bottom';

run;

 

data test;

v=3;

y=max(7,8);

run;

 

proc format

library = work;

select poorothergrp;

run;


Are you attempting to get the description of the format? You need to tell the procedure which catalog to look at.

Perhaps you are wanting:

proc format library = work fmtlib;
  select poorothergrp;
run;

to use the default FORMATS catalog in the work library.

 

Super Contributor
Posts: 371

Re: sas functions

@ballardw :

thank you.

proc format library = work fmtlib;

select poorothergrp;

run;

 

So, I have used it, I see in "result", the format of poorothergrp.

But, I do not get the informations about the functions : max,...

Super User
Posts: 11,343

Re: sas functions


LineMoon wrote:

@ballardw :

thank you.

proc format library = work fmtlib;

select poorothergrp;

run;

 

So, I have used it, I see in "result", the format of poorothergrp.

But, I do not get the informations about the functions : max,...


what are you looking for? You haven't said. Proc FORMAT will only return information about FORMATS, not functions. The code for the dictionary.functions, save as sashelp.vfunc, lists the names of valid functions and a little bit about it, not syntax or behavior. That is what documentation contains. You might try looking at your online help from SAS for Base SAS and functions

Super User
Posts: 19,792

Re: sas functions

@ballardw I think the code you posted may have been intended for another question. Proc Format doesn't come into play when searching for functions.

 

The documentation is the source of truth, bible, gold standard, etc. 

Super User
Posts: 19,792

Re: sas functions

SASHELP.VFUNC

 

 

If you ever want listings of something look at the SASHELP tables.

Ask a Question
Discussion stats
  • 34 replies
  • 499 views
  • 17 likes
  • 8 in conversation