BookmarkSubscribeRSS Feed
uzma03505621
Obsidian | Level 7

I am using Proc transreg to identify which link function will be appropriate for my dependent variable in the GLM model. I used the code as follows:

 

proc transreg data=finalfile;
model boxcox(cost/lambda=-1 to 2 by .5)=identity(&variablelist);
run;

 

 

I get an error
ERROR: 24 invalid values were encountered while attempting to transform variable cost. Is it because my dependent variable has 24 observations with zero costs.

How can I resolve this issue

 

As I changed the code by adding parameter=1

It works giving me the following output and that lamba=0 is selected


The TRANSREG Procedure
TRANSREG Univariate Algorithm Iteration History for BoxCox(cost)
Iteration
Number
Average
Change
Maximum
Change
R-Square Criterion
Change
Note
1 0.00000 0.00000 0.15025   Converged



Algorithm converged.

 

 

 

Please assist me with right method. Thank you

2 REPLIES 2
jiltao
SAS Super FREQ

Your Lambda list includes 0, which is the log transformation. Log of 0 is undefined, and that is why you received that error message.

You might want to exclude these observations, at least for lambda=0.

WarrenKuhfeld
Ammonite | Level 13

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_transreg_details02.htm

 

As you figured out, you can specify PARAMETER= to add a value to each datum to avoid log 0 and other invalid operations. There are many other ways to get nonlinear transformations in TRANSREG and other procedures.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1498 views
  • 6 likes
  • 3 in conversation