turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Would you be able to conclude the association just...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-30-2017 05:53 PM

Here is a dataset about abalone and its indexes.

1)how can I calculate the percentage that the infant in the middle ring group by using sas procedure?

2)I have already got the percent of the infant (sex=I) abalones and the percent of the medium ring group(the ring values between 9 and 11, inclusive), but would I be able to conclude whether the ring group and the sex are associated of not based on these three percentages? (actually the question(2) is not about the sas procedure, it is just a simple statistical question.)

THE INUT FORMAT HAS BEEN GIVEN:

DATA fn.abalone;

LENGTH GROUP $10;

INFILE 'C:\Users\Administrator\Desktop\SAS\final_takehome\abalone.txt' DLM=',' DSD;

/* change the path please! */

INPUT sex $ length diam height whole shucked viscera shell rings;

IF RINGS LT 9 THEN GROUP='SMALL';

ELSE IF RINGS GE 9 AND RINGS LE 11 THEN GROUP='MEDIUM';

ELSE IF RINGS GT 11 THEN GROUP='LARGE';

RUN;

thanks a lot!!!

Accepted Solutions

Solution

05-01-2017
10:21 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Phoebelee

04-30-2017 11:21 PM

Contingency table tests are based on **frequencies**, not percentages. Compare:

```
DATA abalone;
LENGTH GROUP $10;
INFILE "&sasforum\datasets\abalone.txt" DSD;
INPUT sex $ length diam height whole shucked viscera shell rings;
IF RINGS LT 9 THEN GROUP='SMALL';
ELSE IF RINGS GE 9 AND RINGS LE 11 THEN GROUP='MEDIUM';
ELSE IF RINGS GT 11 THEN GROUP='LARGE';
RUN;
/* Tests based on frequencies */
proc freq data=abalone;
table sex*group / deviation chisq out=aba_pct;
exact fisher / mc;
run;
/* Check the percentages */
proc print data=aba_pct noobs; run;
/* Tests based on percentages */
proc freq data=aba_pct;
weight percent;
table sex*group / deviation chisq;
exact fisher / mc; /* Will not work because of non-integer frequencies */
run;
```

PG

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Phoebelee

04-30-2017 07:24 PM

For 2, what test are you using?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

04-30-2017 10:37 PM - edited 05-01-2017 10:22 AM

I think what my prof asked is just simply talking about whether would I be abel to conclude the association based on the three percentages and then use chi square test to check if the results match with the former guess.

Thanks!!

Solution

05-01-2017
10:21 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Phoebelee

04-30-2017 11:21 PM

Contingency table tests are based on **frequencies**, not percentages. Compare:

```
DATA abalone;
LENGTH GROUP $10;
INFILE "&sasforum\datasets\abalone.txt" DSD;
INPUT sex $ length diam height whole shucked viscera shell rings;
IF RINGS LT 9 THEN GROUP='SMALL';
ELSE IF RINGS GE 9 AND RINGS LE 11 THEN GROUP='MEDIUM';
ELSE IF RINGS GT 11 THEN GROUP='LARGE';
RUN;
/* Tests based on frequencies */
proc freq data=abalone;
table sex*group / deviation chisq out=aba_pct;
exact fisher / mc;
run;
/* Check the percentages */
proc print data=aba_pct noobs; run;
/* Tests based on percentages */
proc freq data=aba_pct;
weight percent;
table sex*group / deviation chisq;
exact fisher / mc; /* Will not work because of non-integer frequencies */
run;
```

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

04-30-2017 11:44 PM

Note: The relationship between rings and maturity is better illustrated with logistic regression:

```
data aba_maturity;
set abalone;
mature = sex in ("M", "F");
run;
proc logistic data=aba_maturity;
model mature(event="1") = rings;
effectplot fit(x=rings) / obs(jitter(y=0.1));
run;
```

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

04-30-2017 11:47 PM

Thank you, but would I be able to get an intuitive result just from those three percentages?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Phoebelee

04-30-2017 11:59 PM

You cannot evaluate the relationship between two variables by looking at the proportions for only one variable. I would base my* intuition* on the **deviations** in the freq table. Percentages alone can be missleading as they can be based on small numbers. What if the total number of fish was only 20?

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Phoebelee

05-01-2017 01:06 AM

Always look at both the raw numbers and percentage.

Raw to determine if it matters, percentage for comparison. If the percentages show a huge discrepancy it's usually because of the small N.

What is the possibility of a hospital having only baby boys in a week?

It depends on the number of events - if it only has one or two births a week, it's highly likely this could occur. If it has 1000 births it's really unlikely.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

05-01-2017 10:23 AM

Thank you I think I get it!!