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!!!
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;
For 2, what test are you using?
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!!
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;
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;
Thank you, but would I be able to get an intuitive result just from those three percentages?
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?
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.
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!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.