BookmarkSubscribeRSS Feed
Sara73737
Fluorite | Level 6

Hi. 

I have this table below and I am trying to put the data in SAS to do some analysis.

Screen Shot 2017-09-24 at 1.32.35 PM.png

I am completly new in SAS so I am not sure the code I have below works fine.


DATA placeboStudy;
INPUT value Revascularization $ Treatment $ Study $;
DATALINES;
2 yes Niacin FATS
11 yes Placebo FATS
4 yes Niacin AFREGS
12 yes Placebo AFREGS
1 yes Niacin ARBITER 2
4 yes Placebo ARBITER 2
1 yes Niacin HATS
6 yes Placebo HATS
2 yes Niacin CLAS 1
1 yes Placebo CLAS 1
46 no Niacin FATS
41 no Placebo FATS
67 no Niacin AFREGS
60 no Placebo AFREGS
86 no Niacin ARBITER 2
76 no Placebo ARBITER 2
37 no Niacin HATS
32 no Placebo HATS
92 no Niacin CLAS 1
93 no Placebo CLAS 1
;
RUN;

 

I know how to work with R. I have tried to put the entries in R and did Chi square test. However, when I tried this code in SAS and performed chi square test, I got different results. What do you think is wrong with the code above?

 

* the question i am trying to asnwer is whether the patients on niacin developed coronary artery revascularization more than patiens onPlacebo. The sas results I obtain with this code should a p value greater than 0.05 which seems to be incorrect.

Thank you very much.

1 REPLY 1
Ksharp
Super User
you have three category variables.
and some cell freq < 5, so need Fisher exact test.




DATA placeboStudy;
INPUT value Revascularization $ Treatment $ Study $;
DATALINES;
2 yes Niacin FATS
11 yes Placebo FATS
4 yes Niacin AFREGS
12 yes Placebo AFREGS
1 yes Niacin ARBITER 2
4 yes Placebo ARBITER 2
1 yes Niacin HATS
6 yes Placebo HATS
2 yes Niacin CLAS 1
1 yes Placebo CLAS 1
46 no Niacin FATS
41 no Placebo FATS
67 no Niacin AFREGS
60 no Placebo AFREGS
86 no Niacin ARBITER 2
76 no Placebo ARBITER 2
37 no Niacin HATS
32 no Placebo HATS
92 no Niacin CLAS 1
93 no Placebo CLAS 1
;
RUN;
proc freq data=placeboStudy;
table Study*Revascularization*Treatment/cmh chisq  CELLCHI2 cmh2 fisher;
exact fisher;
weight value;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 1083 views
  • 0 likes
  • 2 in conversation