BookmarkSubscribeRSS Feed
Doug____
Pyrite | Level 9

I created a dataset with all possible combinations of subgroup variables for a binary response. However, no subjects had a response value so PROC FREQ returns the following:

A row or column sum is zero for the table

 

I thought I could get around this by using PROC MEANS to fill all the zero response rows with zeros then use the WEIGHT count/zeros option in FREQ but it does not work. I'm trying to compute CIs for the binomial proportions. Any thoughts?

 

Example Data

Treat           Var              Count

Test           Yes                 0

Test           No                 100

Control      Yes                   0

Control       No                100

10 REPLIES 10
ballardw
Super User

Doesn't work is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of data step code pasted into a code box, the code you used, the actual results and the expected results if possible. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

Doug____
Pyrite | Level 9

proc freq data = counts ;

where subgroupan = 1; <<<<-several subgroups does not matter which one

table trtpn*ev /out = x /*binomial riskdiff exact alpha = 0.1*/ outpct ;

weight count/zeros;

 

*ods output riskdiffcol2 = rd2;

run;

WARNING: Output 'riskdiffcol2' was not created. Make sure that the output object name, label, or path is spelled correctly. Also,

verify that the appropriate procedure options are used to produce the requested output object. For example, verify that

the NOPRINT option is not used.

ballardw
Super User

@Doug____ wrote:

proc freq data = counts ;

where subgroupan = 1; <<<<-several subgroups does not matter which one

table trtpn*ev /out = x /*binomial riskdiff exact alpha = 0.1*/ outpct ;

weight count/zeros;

 

*ods output riskdiffcol2 = rd2;

run;

WARNING: Output 'riskdiffcol2' was not created. Make sure that the output object name, label, or path is spelled correctly. Also,

verify that the appropriate procedure options are used to produce the requested output object. For example, verify that

the NOPRINT option is not used.


Your "example data" in the first post does not include any variables name subgroupan trtpn or ev. So again, I request example data that causes the error.

It is very easy to make a small data set with data step code. From your "example data"

data have;
   input Treat  $         Var $            Count;
datalines;
Test           Yes                 0
Test           No                 100
Control      Yes                   0
Control       No                100
;
run;

The $ are used to read character values.

 

Doug____
Pyrite | Level 9

this is the example that causes the problem because there are no "yes" responses to FREQ does not calculate any CIs for the difference and returns a warning to the log.

ballardw
Super User

@Doug____ wrote:

this is the example that causes the problem because there are no "yes" responses to FREQ does not calculate any CIs for the difference and returns a warning to the log.


From what you have shown so far we can't get to that stage. You have not shown values for any of the variables on the tables statement. So the only thing I can get is errors about missing variables.

 

Either provide data that matches the Proc Freq or provide proc freq that matches the data.

 

 

Doug____
Pyrite | Level 9

AGE1

<55

Control

No

160

AGE1

<55

Control

Yes

0

AGE1

<55

Test

No

141

AGE1

<55

Test

Yes

0

AGE1

>=55

Control

No

98

AGE1

>=55

Control

Yes

0

AGE1

>=55

Test

No

113

AGE1

>=55

Test

Yes

0

These are the summary count data being fed into proc freq

ballardw
Super User

@Doug____ wrote:

AGE1

<55

Control

No

160

AGE1

<55

Control

Yes

0

AGE1

<55

Test

No

141

AGE1

<55

Test

Yes

0

AGE1

>=55

Control

No

98

AGE1

>=55

Control

Yes

0

AGE1

>=55

Test

No

113

AGE1

>=55

Test

Yes

0

These are the summary count data being fed into proc freq


And which variable is which in the Proc Freq code you showed? And that is not a data step and I am not going to clean up that format to make one.

Doug____
Pyrite | Level 9

Freq uses the count variable on the right with a weight statement. So the analysis is for each subgroup is the treatment (Control /Test) * the count variable. Then use the weight variable to get the percentages. Basically you can use the first two rows to run Freq since it is summary data. I was using Freq to get the CIs for the difference but it won't give those since there are no responses (everything is "No").

Reeza
Super User

For 0 values try using the EXACT statement with PROC FREQ. You may also want to look into the ZEROS option. 

 

https://communities.sas.com/t5/SAS-Procedures/Proc-Freq-All-inclusive-table/td-p/202542

 

Not sure if it’ll work for the CI but should appear in the table at least. 

And another option that’s handy is the SPARSE option. 

 


@Doug____ wrote:

Freq uses the count variable on the right with a weight statement. So the analysis is for each subgroup is the treatment (Control /Test) * the count variable. Then use the weight variable to get the percentages. Basically you can use the first two rows to run Freq since it is summary data. I was using Freq to get the CIs for the difference but it won't give those since there are no responses (everything is "No").


 

Doug____
Pyrite | Level 9

I am using weight/zeros already which from the documentation invokes the SPARSE option - the warning still appears.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 10 replies
  • 4112 views
  • 0 likes
  • 3 in conversation