<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Simple Intraclass Correlation on SAS in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Simple-Intraclass-Correlation-on-SAS/m-p/920794#M41272</link>
    <description>&lt;P&gt;Hello everyone! Hope you're doing great!&lt;BR /&gt;I've measured 8 types objects in two diferent times, giving the first time i measured the object its variable name and, after a week, the second time i measured it i gave it the same name followed by a "2".&lt;BR /&gt;As an example: CMDF is the name of the object i measured the first time and CMDF2 is the same object but measured the second time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data correlaçao_medidas;
input NLAF	CMFD	CFFD	CMFE	CFFE	CMMD	CFMD	CMME	CFME	CMFD2	CFFD2	CMFE2	CFFE2	CMMD2	CFMD2	CMME2	CFME2
;
infile datalines dlm='09'x;
cards;
Laf 003/13	46.9	46.6	46.9	46.5	4.9	4.88	4.6	4.83	46.9	46.5	46.9	46.6	5.06	4.99	4.96	4.82
Laf 005/14	45	44.8	45.6	45.4	4.07	3.9	4.14	3.99	45	44.8	45.5	45.4	4.12	3.93	4.12	3.85
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is my data. NLAF is just to know the group of each object.&amp;nbsp;My real data has more than 40 "lafs", so i just brought these two to use as an example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Considering that i got the measurements myself, with no other person measuring the objects, how do i get the intraclass correlation using SAS?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Mon, 18 Mar 2024 17:29:19 GMT</pubDate>
    <dc:creator>NevermoreRedres</dc:creator>
    <dc:date>2024-03-18T17:29:19Z</dc:date>
    <item>
      <title>Simple Intraclass Correlation on SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Simple-Intraclass-Correlation-on-SAS/m-p/920794#M41272</link>
      <description>&lt;P&gt;Hello everyone! Hope you're doing great!&lt;BR /&gt;I've measured 8 types objects in two diferent times, giving the first time i measured the object its variable name and, after a week, the second time i measured it i gave it the same name followed by a "2".&lt;BR /&gt;As an example: CMDF is the name of the object i measured the first time and CMDF2 is the same object but measured the second time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data correlaçao_medidas;
input NLAF	CMFD	CFFD	CMFE	CFFE	CMMD	CFMD	CMME	CFME	CMFD2	CFFD2	CMFE2	CFFE2	CMMD2	CFMD2	CMME2	CFME2
;
infile datalines dlm='09'x;
cards;
Laf 003/13	46.9	46.6	46.9	46.5	4.9	4.88	4.6	4.83	46.9	46.5	46.9	46.6	5.06	4.99	4.96	4.82
Laf 005/14	45	44.8	45.6	45.4	4.07	3.9	4.14	3.99	45	44.8	45.5	45.4	4.12	3.93	4.12	3.85
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is my data. NLAF is just to know the group of each object.&amp;nbsp;My real data has more than 40 "lafs", so i just brought these two to use as an example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Considering that i got the measurements myself, with no other person measuring the objects, how do i get the intraclass correlation using SAS?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 17:29:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Simple-Intraclass-Correlation-on-SAS/m-p/920794#M41272</guid>
      <dc:creator>NevermoreRedres</dc:creator>
      <dc:date>2024-03-18T17:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Intraclass Correlation on SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Simple-Intraclass-Correlation-on-SAS/m-p/920798#M41273</link>
      <description>&lt;P&gt;See&amp;nbsp;&lt;A href="https://support.sas.com/kb/30/333.html#intraclass" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/30/333.html#intraclass&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe you have to rearrange your data so that the second measurement is indicated by a value of 2 in a variable named, for example, MEASUREMENT, rather than by a 2 in the variable's name.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 18:04:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Simple-Intraclass-Correlation-on-SAS/m-p/920798#M41273</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-03-18T18:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Intraclass Correlation on SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Simple-Intraclass-Correlation-on-SAS/m-p/920799#M41274</link>
      <description>&lt;P&gt;Thanks, PaigeMiller!&lt;BR /&gt;I will try it out!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 18:08:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Simple-Intraclass-Correlation-on-SAS/m-p/920799#M41274</guid>
      <dc:creator>NevermoreRedres</dc:creator>
      <dc:date>2024-03-18T18:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Intraclass Correlation on SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Simple-Intraclass-Correlation-on-SAS/m-p/920875#M41281</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
https://support.sas.com/kb/25/031.html
https://support.sas.com/kb/30/333.html#errinvar
https://www.lexjansen.com/nesug/nesug07/sa/sa13.pdf
*/

%let path=%sysfunc(prxchange(s/[^\\]+$//,1,%sysget(SAS_EXECFILEPATH)));
options validvarname=any validmemname=extend mrecall nofmterr nonumber nodate orientation=landscape nodsnferr;


/*准备数据 */
 data FAS;
     input measure_id :$20. @@;
        do subjid='001','002','003','004','005','006';
           input score @;
           output;
        end;
     datalines;
第一次测量   5.9     5.8     5.5     5.6     5.4     5.5
第二次测量   5.9     5.7     5.7     5.8     5.5     5.2
第三次测量   5.9     5.8     5.7     5.6     5.4     5.2
第四次测量   5.9     5.7     5.8     5.7     5.4     5.3
;

data PPS;
 set FAS;
run;



/*导入宏程序*/
%include "&amp;amp;path.\1_macro_intracc.sas"/source;



/*自定义 模板*/
proc template;
 define style styles._journal;
  parent=styles.journal;
   style table from output / cellpadding=0 just=l;
 end;
run;


/*页眉页角*/
title  j=l "(*ESC*)S={fontstyle=roman fontweight=light }申办方：xxxx" 
       j=r "(*ESC*)S={fontstyle=roman fontweight=light }第 (*ESC*){thispage} 页/共 (*ESC*){lastpage} 页";
title2 j=l "(*ESC*)S={fontstyle=roman fontweight=light }某药物临床三期" 
       j=r "(*ESC*)S={fontstyle=roman fontweight=light}数据截止日期：2012-02-14";
footnote j=l "(*ESC*)S={fontstyle=roman fontweight=light }程序： %sysget(SAS_EXECFILENAME) " 
         j=r " (*ESC*)S={fontstyle=roman fontweight=light}运行日期：%sysfunc(datetime(),e8601dt.)  ";




options orientation=portrait leftmargin=2.54cm rightmargin=2.54cm topmargin=1.91cm bottommargin=1.91cm; /*调正页边距，横向还是纵向*/

options mprint mfile;                           /*注意：必须有该语句，用于导出宏产生的SAS代码*/
filename mprint "&amp;amp;path.\宏产生的SAS代码.txt" lrecl=2000;   /*注意：必须有该语句，用于导出宏产生的SAS代码*/

/********************产生报表**********************/
ods rtf file="&amp;amp;path.\report.rtf" style=_journal  ;  


/*宏变量说明：
data      数据集名 
target    用于计算 组内相关系数（ICC） 的组变量名，是模型中的第一个X变量。注意：必须为分类变量（值是离散的），可以为数值型，也可以字符型。
depvar    模型中的Y变量。注意：必须为数值型。
rater     模型中的第二个X变量。注意：必须为分类变量（值是离散的），可以为数值型，也可以字符型。
df        宏变量rater的自由度k（=df+1） .
fas_pps   说明数据是FAS 还是 PPS,影响列头的展示 ,值有 FAS,PPS,SS .....
label     项目名称.影响第一列的展示
*/
proc delete data=output;run; /*运行宏前，一定要运行该语句。*/
%intracc(data=FAS,target=subjid,depvar=score,rater=measure_id ,df=4,fas_pps=FAS ,label=中央角膜厚度 )
%intracc(data=PPS,target=subjid,depvar=score,rater=measure_id ,df=4,fas_pps=PPS ,label=中央角膜厚度 )

%intracc(data=FAS,target=subjid,depvar=score,rater=measure_id ,df=4,fas_pps=FAS ,label=眼轴长度 )
%intracc(data=PPS,target=subjid,depvar=score,rater=measure_id ,df=4,fas_pps=PPS ,label=眼轴长度 )





proc report data=output nowd spanrows style(header)={font_style=roman just=l  fontsize=0.38cm} 
style(report)={outputwidth=100% cellpadding=0 cellspacing=0} style(column)={just=l  fontsize=0.38cm } 
          style={pretext="组内相关系数（ICC）"  fontfamily="MYingHei_18030_C-Medium" fontweight=bold fontsize=0.38cm} 
;
column  proj  value,fas_pps,label;
define proj/group order=data;
define label/across order=data '';
define fas_pps/across order=data   '' style={just=c} ;
define value/group '';
run;
ods text="(*ESC*)S={fontsize=0.38cm fontfamily='MYingHei_18030_C-Medium' asis=on}人口学资料";


ods rtf close;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro intracc(data=,target=,rater=, depvar= ,df=,fas_pps=,label=);
proc glm data=&amp;amp;data outstat=_stats_ noprint ;
  class &amp;amp;target &amp;amp;rater;
  model &amp;amp;depvar = &amp;amp;target &amp;amp;rater ;
  run;

proc sort data=_stats_;
  by _name_ _SOURCE_;
  run;

data want;
  retain msw msb wms ems edf bms bdf jms jdf k;
  set _stats_;
  by _name_;
  if upcase(_type_)='SS1' then delete;
  if upcase(_source_)='ERROR' then do;
     ems=ss/df;
     edf=df;
  end;
  if upcase(_source_)="%upcase(&amp;amp;target)" then do;
     bms=ss/df;
     msb=bms;
     bdf=df;
  end;
  if upcase(_source_)="%upcase(&amp;amp;rater)" then do;
     jms=ss/df;
     jdf=df;
     k=&amp;amp;df.;   /* k=df+1;*/
  end;
  if last._name_ then do;
    msw=((ems*edf)+(jms*jdf))/(edf+jdf);
    wms=msw;
    n=bdf+1;
    sfsingle=(bms-wms)/(bms+(k-1)*wms);        /* ICC(1,1)*/


/*95% Confidence Interval for sfsingle - ICC(1,1) 
Suppose that each of N subjects (targets) yields K observations.*/
F0=bms/wms;
V1=(n-1)*(k-1);
V2=n-1;
FL=F0/quantile('F',.975,V2,V1);
FU=F0*quantile('F',.975,V1,V2);
sfsingle_lower=(FL-1)/(FL+k-1);                /* ICC(1,1) lower CI*/
sfsingle_upper=(FU-1)/(FU+k-1);                /* ICC(1,1) upper CI*/
    output;
  end;
  label  sfsingle="Shrout-Fleiss reliability: single score"
run;





data report;
 set want;
length fas_pps label proj value $ 80;
fas_pps="%upcase(&amp;amp;fas_pps.)";proj="&amp;amp;label."; label proj='指标';

label='值';value=put(sfsingle,10.3 -l);output;
label='95%置信区间';value=cats('(',put(sfsingle_lower,10.3),',',put(sfsingle_upper,10.3),')');output;
keep proj label value fas_pps;
run;
title;

proc append base=output data=report force;run;
%mend intracc;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 05:01:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Simple-Intraclass-Correlation-on-SAS/m-p/920875#M41281</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-03-19T05:01:53Z</dc:date>
    </item>
  </channel>
</rss>

