Question

I have the following SAS prorgram with bugs.

proc sql
create table sigmav_n as 
select std(V) as sigmav_new from bb
quit
...
sysfunc(abs(-sigmac_new))<0.01

Here V is a column name in table bb. And the program throws error as follows,

Argument I to function ABS referenced by %SYSFUNC or %QSYSFUNC macro function is not a number.

Any body know the root cause of this?

Was it helpful?

Solution

Try this:

proc sql
select std(V) into :sigmav_new from bb
quit
...
%sysfunc(abs(-&sigmav_new.))<0.01

This would take the std dev of v, put it into a macro variable (numeric) that could then be used by abs() in the sysfunc command.

You'll probably need a let statement or something else going on or you're going to peform the abs() and the result will just 'float off' into the memory.

It's hard to tell what exactly you want to do with the value without seeing a bit more of your code.

A good SUGI paper on the %sysfunc %SYSFUNC: Extending the SAS Macro Language

OTHER TIPS

Firstly why whould you negate a value before passing it to abs() ?

Nonetheless, try this:

proc sql ;
  select case when (abs(std(v)) <0.01) then 1 else 0 end into :sigmav_new from bb ;
quit ;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top