BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mona4u
Lapis Lazuli | Level 10

Hi All, 

I want to calculate the association within subjects. Each subject has left and right eye and they have a grade for the test is aval and the count for the times they have the grade each time they did the test is aval_count. 

I tried to test the association by the following code and SAS didn't provide me the desired output. 

I'm open to suggestions. 

 

 

data have;
input usubjid :$20. aval alat $ aval_count;
datalines;
7751.000061 1.5 Left 3
7751.000061 1 Right 1
7751.000061 1.5 Right 2
7751.000824 1.5 Left 2
7751.000824 2 Left 1
7751.000824 1.5 Right 1
7751.000824 2 Right 2
7751.002940 1 Left 2
7751.002940 1.5 Left 1
7751.002940 1 Right 2
7751.002940 1.5 Right 1
7751.003306 1.5 Left 2
7751.003306 2 Left 1
7751.003306 1.5 Right 3
7751.003520 1.5 Left 3
7751.003520 1 Right 1
7751.003520 1.5 Right 2
7820.27252833 0 Left 3
7820.27252833 0 Right 3
7820.27253759 0 Left 3
7820.27253759 0 Right 3
7820.27253776 0 Left 3
7820.27253776 0 Right 3
7820.27265336 0 Left 3
7820.27265336 0 Right 3
7820.27270639 0 Left 3
7820.27270639 0 Right 2
7820.27270639 1 Right 1
7820.29087999 0 Left 3
7820.29087999 0 Right 3
7820.40672349 0 Left 3
7820.40672349 0 Right 3
7820.45921053 0 Left 3
7820.45921053 0 Right 3
7820.50956338 0 Left 3
7820.50956338 0 Right 3
7820.51799541 0 Left 1
7820.51799541 0 Right 1
7820.51968934 0 Left 2
7820.51968934 1 Left 1
7820.51968934 0 Right 2
7820.51968934 1 Right 1

run;

proc freq data=have;
tables USUBJID*ALAT*aval/ chisq measures;
weight aval_count;
run;

 

 

Thanks, 

Mona 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
What does correlated mean though? If there isn't a clear definition of what you're trying to do it's almost impossible to write the code.
You have paired data but a few measures, one for each eye I assume. I'd start by graphing it and seeing what that shows I suspect. Weight the scatter plot by the # of tests as a starting point.

View solution in original post

8 REPLIES 8
ballardw
Super User

Your counts within levels of Usubjid as shown are pretty small for just about any purpose with 6 seeming to be the typical number of "grades". Splitting that by just about any other variable makes the cell counts so small to be almost meaningless.

 

I do find the structure of your Usubjid to be a tad odd. Typically most identification schemes don't go in for decimals. By any chance did you actually intend to this test using just the first 4 characters of the Usubjid value?

 

Please describe the "desired output" since it appears that you have some idea of what you wanted. Please not that Chi-squares don't like cells with 0 counts as you likely got in your output.

 

You might try using Usubjid as a BY variable and remove it from the Tables statement. That would at least reduce the number of 0 cell sizes but then you are going to have groups with only one value of Aval. Which isn't really going to be very testable.

mona4u
Lapis Lazuli | Level 10

aval 0, 1, 1.5 2 is a categorical variable. 

aval count counts the number of each aval grades happen in each eye. 

 

I want the test of association within eyes for each subject between all subjects. 

Proc freq doesn't provide me any statistics when I use the proc freq the way I use it. Maybe there is a better way to get my desired outcomes. 

 

 

Reeza
Super User
What does this mean: "I want the test of association within eyes for each subject between all subjects."? What is that as a hypothesis?
mona4u
Lapis Lazuli | Level 10

test the association between eyes for each subject and for all subjects

Reeza
Super User
That's not a hypothesis 😞
mona4u
Lapis Lazuli | Level 10

I don't have a hypothesis I just want to know how they are correlated either using this procedure or other procedures. 

 

 

Thanks 

Reeza
Super User
What does correlated mean though? If there isn't a clear definition of what you're trying to do it's almost impossible to write the code.
You have paired data but a few measures, one for each eye I assume. I'd start by graphing it and seeing what that shows I suspect. Weight the scatter plot by the # of tests as a starting point.
mona4u
Lapis Lazuli | Level 10

Hi Reeza, 

I want to see the correlation between the subjects' scores between their eyes left and right. 

this is a repeated measurement and aval record the grade of the test. 

Not sure how to start as the data is a bit complicated. 

 

 

Thanks, 

Mona