<?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 Re: HW Question | Using a macro and I'm confused as to creating the variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/HW-Question-Using-a-macro-and-I-m-confused-as-to-creating-the/m-p/458497#M284524</link>
    <description>&lt;P&gt;Thank you so much for your help!&amp;nbsp; This is the partial coding (part relevant with the macro).&amp;nbsp; Is this right?&amp;nbsp; I need to be able to create the second variable within the if / then statement.&amp;nbsp; Could there be an if/then/and ... else then... and repeat?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET cutoff1 = 0.4;&lt;BR /&gt;%LET cutoff2 = 0.5;&lt;BR /&gt;%LET cutoff3 = 0.6;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC FORMAT;&lt;BR /&gt;value raterfmt 1 = 'Yes'&lt;BR /&gt;2 = 'No';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA agree2;&lt;BR /&gt;set agree1;&lt;BR /&gt;if random lt &amp;amp;cutoff1 then rater1=1;&lt;BR /&gt;else if random ge &amp;amp;cutoff1 and random le &amp;amp;cutoff2 then rater1=1;&lt;BR /&gt;else if random ge &amp;amp;cutoff2 and random le &amp;amp;cutoff3 then rater1=2;&lt;BR /&gt;else if random ge &amp;amp;cutoff3 then rater1=2;&lt;BR /&gt;format rater1 raterfmt.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Apr 2018 00:31:50 GMT</pubDate>
    <dc:creator>audreys</dc:creator>
    <dc:date>2018-04-30T00:31:50Z</dc:date>
    <item>
      <title>HW Question | Using a macro and I'm confused as to creating the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HW-Question-Using-a-macro-and-I-m-confused-as-to-creating-the/m-p/458494#M284522</link>
      <description>&lt;P&gt;I understand the RANUNI fuction but for the life of me I can't understand the three macro variables part of the question.&amp;nbsp; If you can help I would be extremely grateful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In summary, your job here is to use the RANUNI function in conjunction with a DO loop and an OUTPUT statement to create a temporary SAS data set called &lt;EM&gt;agree&lt;/EM&gt; containing 100 observations and two character variables called &lt;EM&gt;rater1&lt;/EM&gt; and &lt;EM&gt;rater2&lt;/EM&gt;. (We'll use the data set to calculate the Kappa coefficient between the two raters.) Now, here are the specific requirements for the problem:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Use a seed of 456 in your RANUNI function so that we all create the same data set.&lt;/LI&gt;&lt;LI&gt;For each iteration of the DO loop: (1) if the value returned by the RANUNI function is less than 0.4, set &lt;EM&gt;rater1&lt;/EM&gt; to equal Yes and &lt;EM&gt;rater2&lt;/EM&gt; to equal Yes; (2) if the value returned by the RANUNI function is at least 0.4, but less than 0.5, set &lt;EM&gt;rater1&lt;/EM&gt; to equal Yes and &lt;EM&gt;rater2&lt;/EM&gt; to equal No; (3) if the value returned by the RANUNI function is at least 0.5, but less than 0.6, set &lt;EM&gt;rater1&lt;/EM&gt; to equal No and &lt;EM&gt;rater2&lt;/EM&gt; to equal Yes; and (4) if the value returned by the RANUNI function is at least 0.6, set &lt;EM&gt;rater1&lt;/EM&gt; to equal No and &lt;EM&gt;rater2&lt;/EM&gt; to equal No.&lt;/LI&gt;&lt;LI&gt;Write the code using three macro variables called &lt;EM&gt;cutoff1&lt;/EM&gt;, &lt;EM&gt;cutoff2&lt;/EM&gt;, and &lt;EM&gt;cutoff3&lt;/EM&gt; so that the cutoff values of 0.4, 0.5, and 0.6 could be changed easily.&lt;/LI&gt;&lt;LI&gt;Compute the Kappa coefficient between the two raters.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;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 &lt;EM&gt;cutoff1&lt;/EM&gt;, &lt;EM&gt;cutoff2&lt;/EM&gt;, and &lt;EM&gt;cutoff3&lt;/EM&gt; macro variables.)&lt;/P&gt;</description>
      <pubDate>Sun, 29 Apr 2018 23:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HW-Question-Using-a-macro-and-I-m-confused-as-to-creating-the/m-p/458494#M284522</guid>
      <dc:creator>audreys</dc:creator>
      <dc:date>2018-04-29T23:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: HW Question | Using a macro and I'm confused as to creating the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HW-Question-Using-a-macro-and-I-m-confused-as-to-creating-the/m-p/458495#M284523</link>
      <description>&lt;P&gt;To sort the results into 4 groups you have 3 cutoffs.&lt;/P&gt;
&lt;P&gt;Using macro variable enables to assign values outside of the datastep,&lt;/P&gt;
&lt;P&gt;thus changing cutoff values will be easy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use &lt;STRONG&gt;%LET cuttoff1=0.4;&lt;/STRONG&gt;&amp;nbsp; to assign value to the 1st macro variable.&lt;/P&gt;
&lt;P&gt;Then use &lt;STRONG&gt;&amp;amp;cutoff1 &lt;/STRONG&gt;inside your datastep code instead the specific value,&lt;/P&gt;
&lt;P&gt;like:&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;if&amp;nbsp; result &amp;lt; &amp;amp;cutoff1 then ...&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still have issues post the code you wrote.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 00:22:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HW-Question-Using-a-macro-and-I-m-confused-as-to-creating-the/m-p/458495#M284523</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-04-30T00:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: HW Question | Using a macro and I'm confused as to creating the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HW-Question-Using-a-macro-and-I-m-confused-as-to-creating-the/m-p/458497#M284524</link>
      <description>&lt;P&gt;Thank you so much for your help!&amp;nbsp; This is the partial coding (part relevant with the macro).&amp;nbsp; Is this right?&amp;nbsp; I need to be able to create the second variable within the if / then statement.&amp;nbsp; Could there be an if/then/and ... else then... and repeat?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET cutoff1 = 0.4;&lt;BR /&gt;%LET cutoff2 = 0.5;&lt;BR /&gt;%LET cutoff3 = 0.6;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC FORMAT;&lt;BR /&gt;value raterfmt 1 = 'Yes'&lt;BR /&gt;2 = 'No';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA agree2;&lt;BR /&gt;set agree1;&lt;BR /&gt;if random lt &amp;amp;cutoff1 then rater1=1;&lt;BR /&gt;else if random ge &amp;amp;cutoff1 and random le &amp;amp;cutoff2 then rater1=1;&lt;BR /&gt;else if random ge &amp;amp;cutoff2 and random le &amp;amp;cutoff3 then rater1=2;&lt;BR /&gt;else if random ge &amp;amp;cutoff3 then rater1=2;&lt;BR /&gt;format rater1 raterfmt.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 00:31:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HW-Question-Using-a-macro-and-I-m-confused-as-to-creating-the/m-p/458497#M284524</guid>
      <dc:creator>audreys</dc:creator>
      <dc:date>2018-04-30T00:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: HW Question | Using a macro and I'm confused as to creating the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HW-Question-Using-a-macro-and-I-m-confused-as-to-creating-the/m-p/458501#M284525</link>
      <description>&lt;P&gt;Your code seems to be correct. Better try to run it.&lt;/P&gt;
&lt;P&gt;Add &lt;STRONG&gt;RUN; &lt;/STRONG&gt;to close the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, you can use format to assign the cutoffs instead IF ...THEN...; ELSE ...&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format lib=work;
  value raterfmt
       1 = 'YES'
       2 = 'NO'
   ;
   vaulue cutoff
    low - &amp;amp;cutoff1 = '1'
   &amp;amp;cutoff1 - &amp;amp;cutoff2 = '2'
   &amp;amp;cutoff2 - &amp;amp;cutoff3 = '3'
   &amp;amp;cutoff3 - high = '4'
  ;
run;

data agree2;
  set agree1;
       rater1 = put(random, cutoff.);
       format rater1 raterfmt. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Apr 2018 01:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HW-Question-Using-a-macro-and-I-m-confused-as-to-creating-the/m-p/458501#M284525</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-04-30T01:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: HW Question | Using a macro and I'm confused as to creating the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HW-Question-Using-a-macro-and-I-m-confused-as-to-creating-the/m-p/458512#M284526</link>
      <description>&lt;P&gt;Great - thank you so much!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 02:32:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HW-Question-Using-a-macro-and-I-m-confused-as-to-creating-the/m-p/458512#M284526</guid>
      <dc:creator>audreys</dc:creator>
      <dc:date>2018-04-30T02:32:47Z</dc:date>
    </item>
  </channel>
</rss>

