DATA Step, Macro, Functions and more

How do I fix this error: ERROR 159-185: Null parameters for DIVIDE are invalid.

Reply
Contributor
Posts: 61

How do I fix this error: ERROR 159-185: Null parameters for DIVIDE are invalid.

This is SAS log excerpt:

 

 

 

%LET RNSOBKA = ;  %LET RNSOBKD = ;  %LET RNSOHSOD = ;  %LET RNSOBKP = ;  %LET RNSONFA = ;
114478    +%LET RNESBKA = ;  %LET RNESBKD = ;  %LET RNESHHOD = ;  %LET RNESBKP = ;  %LET RNESNFA = ;
114479    +%LET RNCUBKA = ;  %LET RNCUBKD = ;  %LET RNCUHSOD = ;  %LET RNCUBKP = ;  %LET RNCUNFA = ;
114480    +
114481    +%ren_exc(bp=PWM) ;
114481      region1_n region2_n region3_n SO_HSO_pct_nf;    SO_HSO_dollars = left(trim(put(Total_n,dollar14.)));    call symput("RNSOHSOD",trim(SO_HSO_dollars)) ;
114481   !     SO_HSO_pct_nf = left(trim(put(divide(Total_n,&RNSONFA.),percent7.2))) ;    call symput("RNSOHSOP",
                                                                     _
                                                                     159
ERROR 159-185: Null parameters for DIVIDE are invalid.

WARNING: The data set WORK.TOTAL_HS_OVERRIDES may be incomplete.  When this step was stopped there were 0 observations and 7 variables.
WARNING: Data set WORK.TOTAL_HS_OVERRIDES was not replaced because this step was stopped.

Respected Advisor
Posts: 3,777

Re: How do I fix this error: ERROR 159-185: Null parameters for DIVIDE are invalid.

Give &RNSONFA a value that.

Super User
Posts: 10,483

Re: How do I fix this error: ERROR 159-185: Null parameters for DIVIDE are invalid.

I recommend considering using the function STRIP to reduce the number of parantheses involved. You find a lot of code with trim(left(<value>)) because a long time ago there was no single function to do that. Strip was introduced as an alternative to trim(left because we used that so frequently.

Super User
Posts: 6,928

Re: How do I fix this error: ERROR 159-185: Null parameters for DIVIDE are invalid.

You do

%LET RNSONFA = ;

That causes the macro variable RNSONFA to be empty.

When you do

divide(Total_n,&RNSONFA.)

this resolves (after macro expansion/interpretation) to

divide(Total_n, )

which is invalid.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 61

Re: How do I fix this error: ERROR 159-185: Null parameters for DIVIDE are invalid.

I inherited this program from a programmer that left the company 3 months ago.  This report has been running on scheduler since then, without error.  Why is something that has been working all along, now causing an error ?

Super User
Posts: 6,928

Re: How do I fix this error: ERROR 159-185: Null parameters for DIVIDE are invalid.

To really determine that, one would need a holistic view.

Complete code, everything concerning the scheduling, code of the system batch scripts, etc

Take a look at the revision history.

Something has changed, or the problem would have been there from the beginning.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 5 replies
  • 517 views
  • 1 like
  • 4 in conversation