This assignment is overwhelming, any assistance will help!
Use the RANUNI function in conjunction with a DO loop and an OUTPUT statement to create a temporary SAS data set called agree containing 100 observations and two character variables called rater1 and rater2. (We'll use the data set to calculate the Kappa coefficient between the two raters.) Now, here are the specific requirements for the problem:
What is the Kappa coefficient when the cutoff values are set at 0.4, 0.5, and 0.6?
What level of agreement does it suggest exists between the two raters?
What is the Kappa coefficient when the cutoff values are set at 0.2, 0.5, and 0.8?
What level of agreement does it suggest exists between the two raters then? (Hint: I recommend first getting the code to work using the values 0.4, 0.5, and 0.6. Then replace those values with the cutoff1, cutoff2, and cutoff3 macro variables.)
And the question is?
What have you tried so far?
I don't know your instructor but using values of "Yes" and "No" is sub-optimal coding.
DATA agree;
DO units = 1 to 100;
Random = RANUNI (456);
OUTPUT;
END;
RUN;
@mpc5 wrote:
DATA agree;
DO units = 1 to 100;
Random = RANUNI (456);
OUTPUT;
END;
RUN;
Reasonable start.
So now I expect the teacher wants some If/then/else statements to assign the values for the Rater variables. They would come before the Output statement.
can a "THEN" statement equal more than one response?
example this is what i have for the first if then statement;
IF _N_ lt 0.4 then rater1= 'Yes' and rater2= 'Yes';
Use a DO/END block to execute multiple statements.
if (condition) then do;
statement1;
statement2;
end;
This is what I have so far, NEED HELP:
DATA agree;
DO units = 1 to 100;
Random = RANUNI (456);
IF _N_ lt 0.4 then rater1= 'Yes' and rater2= 'Yes';
ELSE IF _N_ ge 0.4 and lt 0.5 then rater1= 'Yes' and rater2= 'No';
ELSE IF _N_ ge 0.5 and lt 0.6 then rater1= 'No' and rater2= 'Yes';
ELSE IF _N_ ge 0.6 then rater1= 'No' and rater2= 'No';
OUTPUT;
END;
RUN;
%MACRO agreecuts (cutoff=);
DATA agree;
set agree;
RUN;
%MEND;
%AGREECUTS(cutoff= 0.4)
%AGREECUTS(cutoff= 0.5)
%AGREECUTS(cutoff= 0.6)
HERE IS MY LOG:
75
76 DATA agree;
77 DO units = 1 to 100;
78 Random = RANUNI (456);
79
80 IF _N_ lt 0.4 then rater1= 'Yes' and rater2= 'Yes';
81 ELSE IF _N_ ge 0.4 and lt 0.5 then rater1= 'Yes' and rater2= 'No';
---
388
200
82 ELSE IF _N_ ge 0.5 and lt 0.6 then rater1= 'No' and rater2= 'Yes';
---- ---
160 388
200
83 ELSE IF _N_ ge 0.6 then rater1= 'No' and rater2= 'No';
----
160
ERROR 388-185: Expecting an arithmetic operator.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 160-185: No matching IF-THEN clause.
84 OUTPUT;
85 END;
86 RUN;
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
80:48 81:48 82:48 83:48
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.AGREE may be incomplete. When this step was stopped there were 0
observations and 5 variables.
WARNING: Data set WORK.AGREE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.04 seconds
87
88 %MACRO agreecuts (cutoff=);
89 DATA agree;
90 set agree;
91 RUN;
92
93 %MEND;
94
95 %AGREECUTS(cutoff= 0.4)
NOTE: There were 0 observations read from the data set WORK.AGREE.
NOTE: The data set WORK.AGREE has 0 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
96 %AGREECUTS(cutoff= 0.5)
NOTE: There were 0 observations read from the data set WORK.AGREE.
NOTE: The data set WORK.AGREE has 0 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
97 %AGREECUTS(cutoff= 0.6)
NOTE: There were 0 observations read from the data set WORK.AGREE.
NOTE: The data set WORK.AGREE has 0 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
If you add a comment to your code for every line I'll help you with the answer.
Put a comment with what you think each line is doing.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.