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;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 1 reply
  • 810 views
  • 0 likes
  • 2 in conversation