BookmarkSubscribeRSS Feed
Dedes93
Calcite | Level 5

Hi,

I need to run a linear regression with two categorical variables with 3 plus levels and one continuous variable on a continuous response variable, and is Thus using proc GLM.

 

Continuous variables:

- Price

- rating

 

Categorical varibles:

- product=(agriculture, rental, industry)

- customer_segment=(key, focus, corporate)

 

Is it possible to run the following regression, and if so how do you specify the interaction terms:

 

Proc GLM data=model1_data2 alpha=0.75;

class product customer_segment;

model price=rating product customer_segment industry*rating industry*key / solution;

output out=model1_v2_out r=res p=benchmark2 lcl=Q25 ucl=Q75;

Data model1_data2;

set model1_v2_out;

run;

 

So my issue is that i don't know how to specify interaction terms only involving specific levels of the categorical variable.

Hopes this makes sence.

I'm using SAS 9.4

 

Best, Andreas

1 REPLY 1
WarrenKuhfeld
Rhodochrosite | Level 12

https://blogs.sas.com/content/iml/2016/02/22/create-dummy-variables-in-sas.html

Many procedures output coded variables.  You can then process the output data set to drop terms.  Personally, I like transreg because 1) I wrote it, 2) it has nice names and labels for terms, and 3) it outputs a macro variable with all of the terms in the model.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 4307 views
  • 1 like
  • 2 in conversation