BookmarkSubscribeRSS Feed
Lena_PA
Fluorite | Level 6

Hello 

I would like to test the variable "beta", "gamma", and "alpha" (these are continuous variables) in two different level of "pet_type". Pet_type is a class variable with two values: "dog" or "cat". Ultimately, I would like to have a graph something like this 

Lena_PA_0-1699341128993.png

my code is 


proc glm data = have ;
class pet_type ;
model logsale = beta gamma alpha pet_type pet_type*beta pet_type*gamma pet_type*alpha/ss3;
lsmeans pet_type*gamma/ slice = pet_type;
lsmeans pet_type*beta/ slice = pet_type;
lsmeans pet_type*alpha/ slice = pet_type;
run;

 

but I've got an error message that "only CLASS variables allowed in this effect." Please help! 

3 REPLIES 3
Ksharp
Super User
Since LSMEANS compare the mean of Y in two or more groups within CLASS variable, like ANOVA . You should use CATEGORY variable in it.
lsmeans pet_type*gamma/ slice = pet_type;
-->
lsmeans pet_type/ diff ;
Lena_PA
Fluorite | Level 6

Thank you for letting me know! Pet_type is a category variable but alpha, beta, and gamma are not.. so what do you suggest?

Ksharp
Super User
If You want to check the difference of ALPHA within a category variable,you should check this :

https://support.sas.com/kb/38/384.html

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 559 views
  • 2 likes
  • 2 in conversation