BookmarkSubscribeRSS Feed
Jonas3007
Calcite | Level 5

Hello, 

I have a few questions (Completely new to SAS) I have the following table.

 

 

Outcome

 

Treatment

Recurring UTI

No new UTI

Total

Cranberry Juice

8

42

50

Lactobacillus drink

19

30

49

Control

18

32

50

 

1. Question about percentages. I need to convert each value into their respective percentages and get the chi-square. what would be the steps to create this table in SAS (exactly as it shows) and then make the same table but showing the values in percentages? I tried using proc freq but it just shows me the percentage of the total column.

2. from this table, how can I get the chi-square?

3. Finally, how do I make a graph to compare these percents?

 

Thank you!

1 REPLY 1
ballardw
Super User

@Jonas3007 wrote:

Hello, 

I have a few questions (Completely new to SAS) I have the following table.

 

 

Outcome

 

Treatment

Recurring UTI

No new UTI

Total

Cranberry Juice

8

42

50

Lactobacillus drink

19

30

49

Control

18

32

50

 

1. Question about percentages. I need to convert each value into their respective percentages and get the chi-square. what would be the steps to create this table in SAS (exactly as it shows) and then make the same table but showing the values in percentages? I tried using proc freq but it just shows me the percentage of the total column.

2. from this table, how can I get the chi-square?

3. Finally, how do I make a graph to compare these percents?

 

Thank you!


Whenever you discuss percentage you must define what the denominator and numerator are for the calculation. Which you don't do. So, what are the denominators and numerators.

 

Without an actual data set it is hard to write code.

Without seeing the code you attempted we have no idea what may or may not have been done.

And many people new to SAS whose "training" came from working with spreadsheets often have separate variables (columns, rows) such as "recurring" and "new" instead of a single variable possibly named "outcome" with two levels of values.

 

Can you provide an example of your data? Either in the form of a data step or at least proc print or similar output?

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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