BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ANKH1
Pyrite | Level 9

What would be the procedure equivalent to proc transreg for ANOVAS (categorical IV's)? We are looking to use boxcox transformations on a continuous DV. 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

The documentation for the TRANSREG section on the Box-Cox transformation says,

"This family of transformations of the positive [emphasis added] dependent variable y is controlled by the parameter ...."

 

It also states that you can "specify the PARAMETER=c transformation option when you want to shift the values of y, usually to avoid negatives." So when DV=0, you can to get rid of the error and apply the BC transformation by adding any positve value, such as the following (which adds 1):

 

proc transreg data=Have;
   model BoxCox(DV / lambda=1 parameter=1) = class(cat);
run;

View solution in original post

21 REPLIES 21
Community_Guide
SAS Moderator

Hello @ANKH1,


Your question requires more details before experts can help. Can you revise your question to include more information? 

 

Review this checklist:

  • Specify a meaningful subject line for your topic.  Avoid generic subjects like "need help," "SAS query," or "urgent."
  • When appropriate, provide sample data in text or DATA step format.  See this article for one method you can use.
  • If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition. Use the Photos button to include the image in your message.
    use_buttons.png
  • It also helps to include an example (table or picture) of the result that you're trying to achieve.

To edit your original message, select the "blue gear" icon at the top of the message and select Edit Message.  From there you can adjust the title and add more details to the body of the message.  Or, simply reply to this message with any additional information you can supply.

 

edit_post.png

SAS experts are eager to help -- help them by providing as much detail as you can.

 

This prewritten response was triggered for you by fellow SAS Support Communities member @PGStats

.
PaigeMiller
Diamond | Level 26

@ANKH1 wrote:

What would be the procedure equivalent to proc transreg for ANOVAS (categorical IV's)? We are looking to use boxcox transformations on a continuous DV. 


You would want to use the CLASS transformation of the MODEL statement.

--
Paige Miller
ANKH1
Pyrite | Level 9
Hi,
I tried the following:
74 proc transreg data = sample1;
75 model boxcox(DV)=class(CAT);
76 run;

ERROR: 11 invalid values were encountered while attempting to transform variable DV.

The 11 invalid values are from values=0. Moreover, when I write

proc transreg data = sample1;
model boxcox(DV/lambda=1)=class(IV);
run;

It shows exactly the same error.
PaigeMiller
Diamond | Level 26

Are you sure that the error is not because you have negative values of DV?

 

Please show us a portion of your data set SAMPLE1, following these instructions: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

 

 

--
Paige Miller
ANKH1
Pyrite | Level 9

Hi, 

 

Thank you for your answer.

 

We don't have negative values in that DV. I tried following the code you provided to show our data but I guess I couldn't figured out how since our data set is an imported excel file with approx 19900 rows and 80 columns. 

 

I tried the code with another DV to see if it could be another reason, but again it showed an error for one value. I checked for that DV and that one value seems to be again coming from only one value = 0. 

 

 

 

PaigeMiller
Diamond | Level 26

As an experiment, run the PROC TRANSREG on a data set which doesn't have 0 values for Y using

 

model boxcox(DV/lambda=1)=class(IV);

and see if the error goes away.

--
Paige Miller
ANKH1
Pyrite | Level 9

It did run! 

PaigeMiller
Diamond | Level 26

Okay, but I can't explain why 0 is considered an invalid value for Y in the Box-Cox transformation with λ=1. Maybe @PGStats or @ballardw has some insight here. Or you could always talk to SAS tech support.

--
Paige Miller
ANKH1
Pyrite | Level 9
Thank you!
ballardw
Super User

@ANKH1 wrote:

Hi, 

 

Thank you for your answer.

 

We don't have negative values in that DV. I tried following the code you provided to show our data but I guess I couldn't figured out how since our data set is an imported excel file with approx 19900 rows and 80 columns. 

 

I tried the code with another DV to see if it could be another reason, but again it showed an error for one value. I checked for that DV and that one value seems to be again coming from only one value = 0. 

 

 

 


How exactly did you check for negative values? Since you say that you "imported" and Excel file there are times when, depending on the display settings in Excel  very small magnitude negative value, such as -0.000001, could appear as 0.00 with the default 2 decimals in Excel and Proc Import might honor that setting or just not show if the value has a BEST format associated.

 

Consider:

data example;
   x= -0.00001;
   format x best4.;
   put x= ;
run;

The log will show x=0. As would a table view or proc print.

 

This may be a long shot but "mystery" behaviors sometimes require examining the less common issues.

PaigeMiller
Diamond | Level 26

That's an interesting thought.

 

This implies that @ANKH1 ought to do something like

 

proc print data=sample1(where=(dv<0));
--
Paige Miller
Rick_SAS
SAS Super FREQ

Or use PROC MEANS to examine the minimum:

 

proc means data=sample1 fw=18 macdec=16;
   var dv;
run;
ANKH1
Pyrite | Level 9

Hi, 

I ran the code and didn't get any negative values. 

PaigeMiller
Diamond | Level 26

So, that's not it, but I don't really have any other suggestions about what might be causing this. I would still contact SAS Tech support to see if they have an explanation.

--
Paige Miller

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 21 replies
  • 2683 views
  • 2 likes
  • 5 in conversation