BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

Hello,

I have Proc Freq statement below.

 

proc freq data=test;
	table Airway / out=Airway_Total_N nocol norow nocum;
	where Age_group in (1,2,3,4) and C_Underly=1;
	format Age_group Age_group.;
run;

proc freq data=test;
	table Prematurity / out=Prematurity_Total_N nocol norow nocum;
	where Age_group in (1,2,3,4) and C_Underly=1;
	format Age_group Age_group.;
run;

I found out the percent results obtained from Airway(44.9%) and Prematurity(70.5%) subgroups.  I I expect the percent sum should not be over 100% because I would like to use."Age_group in (1,2,3,4) and C_Underly=1" as the denominator.   Where did I do wrong? how to fix ti?  Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

If you run two PROC FREQs separately, SAS doesn't know that the maximum in your mind should be 100%. I think it should not be 100%. The reason it is over 100% is that subjects can be in both the AIRWAY and PREMATURITY groups.

 

Perhaps you want to run one PROC FREQ like this:

 

table Airway*Prematurity / out=Airway_Total_N nocol norow nocum;

 

then you will get results that add to 100%. Whether or not this particular analysis is what you want is a different question, you didn't say exactly what you do want. 

--
Paige Miller

View solution in original post

2 REPLIES 2
Reeza
Super User

I found out the percent results obtained from Airway(44.9%) and Prematurity(70.5%) subgroups

 

Why would you expect two different variables to add up to 100%?

 

PaigeMiller
Diamond | Level 26

If you run two PROC FREQs separately, SAS doesn't know that the maximum in your mind should be 100%. I think it should not be 100%. The reason it is over 100% is that subjects can be in both the AIRWAY and PREMATURITY groups.

 

Perhaps you want to run one PROC FREQ like this:

 

table Airway*Prematurity / out=Airway_Total_N nocol norow nocum;

 

then you will get results that add to 100%. Whether or not this particular analysis is what you want is a different question, you didn't say exactly what you do want. 

--
Paige Miller

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 ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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