SAS Studio

Write and run SAS programs in your web browser
BookmarkSubscribeRSS Feed
khem
Calcite | Level 5

Hi,
I am trying to do ANCOVA using the SAS studio for three categories based on data. Please may i know how can i use 3 categorical variables at the same time? My collaborators used the same data and used the SAS enterprise guide (which i don't have) and used 3 variables together. using 1 variable is not helping me to reproduce similar results. I need to reproduce the same results for further analysis.

Here i have attached the data and results from SAS enterprise guide,

In the data zero (o) means "without diet", and one (1) means "with diet".

Please help me, Thanks,
Khem

30 REPLIES 30
PaigeMiller
Diamond | Level 26

We really would benefit from seeing the code used by your collaborators. Neverthess, this code should produce an ANCOVA with 3 categorical variables (which I have named CAT1 CAT2 and CAT3) and one covariate (which I have named X)

 

proc glm data=have;
    class cat1 cat2 cat3;
    model y = x cat1 cat2 cat3;
run;
quit;
--
Paige Miller
khem
Calcite | Level 5

Hi @PaigeMiller  Thanks for the quick response,

I ran again with your suggested code,

I could up to typeIII values and F values, this is great, Exact same like my collaborator,

I attached my results too (SAS_studio...pdf)

But i am not able to get the estimate and t and Pr>t values (please check the attached file [ancova_cassie...] for results from a collaborator) like my collaborators had,

Please can you help me on this too,

They used SAS enterprise guide, so i am not sure, if they will have codes for them,

Thanks,

Khem

 

PaigeMiller
Diamond | Level 26

Generally, I do not download attachments. Please post the relevant information as a screen capture in your message.

--
Paige Miller
khem
Calcite | Level 5

Hi @PaigeMiller ,

Okay,

Here i dropped the screen images for the results of my collaborator (first one with blue font) and mine (image with black&white font). My results are based on your previous suggestion. I got similar values for TypeIII and Pr>F like my collaborator, which is great. Your suggestion is in the perfect and right direction for my data. Please kindly suggest me how can I get similar intercept and Pr>t values too? for the reference, I also put the image of my datasheet.

khem_1-1596585071512.png

khem_2-1596585100121.png

khem_3-1596585287412.png

 

Note: Here In the data zero (o) means "without diet", and one (1) means "with diet"

 

Thanks,

Khem

PaigeMiller
Diamond | Level 26

I don't see any similarity. It doesn't even look like you have the same data or the same response variable.

 
You really need to confirm you have the same data and are using the same code.
 
 
--
Paige Miller
khem
Calcite | Level 5

Hi @PaigeMiller 

I am really sorry,

I uploaded the wrong file of my collaborator,

Here i attached the right file of my collaborator, along with my same results (after your suggestion, black&whilte figure) and data from my previous post,

 

khem_0-1596588309757.png

khem_2-1596588360207.png

 

 

khem_1-1596588329258.png

Here I got similar values for TypeIII and Pr>F like my collaborator, now i need to get same intercept, estimates, Pr>t values.

 

Sorry again,

Khem

 

 

PaigeMiller
Diamond | Level 26

You don't show the intercept or estimates for the 2nd analysis.

 
--
Paige Miller
khem
Calcite | Level 5

Hi @PaigeMiller ,

 

Second analysis i did,  based on your first suggestion but when i ran your equation in SAS studio, I didn't get the intercept, estimates and Pr>t values. 

do i need to add something into your previous equation?

 

Thanks,

Khem

PaigeMiller
Diamond | Level 26

oh, I understand now, that was my omission. Use this MODEL statement with the SOLUTION option

 

model y = x cat1 cat2 cat3/solution;

 

 

--
Paige Miller
khem
Calcite | Level 5

Hi @PaigeMiller 

Thanks for the suggestion, it worked,

Here is the image

khem_0-1596655037627.png

 

I got the same estimate and Pr>t values for all three diets,

Only one doubt, the estimate of intercept is not matching,

My collaborator had 1.26 (in previous post figure) but mine is 2.60. Does it matter? do i need to make any changes?

Thanks again,

Khem

PaigeMiller
Diamond | Level 26

That's very odd, and I don't have an explanation about how everything can be the same except the intercept.

--
Paige Miller
khem
Calcite | Level 5

Oh,

Here i attached my codes, if it may help you,

khem_0-1596656741980.png

 

khem_1-1596656788788.png

Thanks,

Khem

khem
Calcite | Level 5

Hi @PaigeMiller ,

 

Sorry to bother you again,

is it possible to reproduce your model for ANCOVA in R?

If yes, can you suggest to me how? what should i add for solution (SAS studio) option in R?

 

Thanks,

Khem

PaigeMiller
Diamond | Level 26

You need to ask your question in an R forum and not in a SAS forum.

--
Paige Miller

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 30 replies
  • 4832 views
  • 3 likes
  • 3 in conversation