<?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: Problem with code for reverse coding scale items in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499734#M133016</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, I sent the wrong log with extraneous stuff. The attached log should be easier to&amp;nbsp; understand.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Sep 2018 23:35:09 GMT</pubDate>
    <dc:creator>amcr729</dc:creator>
    <dc:date>2018-09-27T23:35:09Z</dc:date>
    <item>
      <title>Problem with code for reverse coding scale items</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499722#M133008</link>
      <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am reverse coding a subset of items in a scale using an array and a quantitative transformation. The response options for the scale items are: (1) totally disagree, (2) disagree, (3) agree, and (4) totally agree (there are also special codes for "don't know" and "refused" answers, but I have already recoded those to missing (i.e. "."). After I run my code and check my work by looking at frequency tables however, I can see that something is wrong because the tables are completely empty and show all observations to be missing. I am wracking my brain but cannot figure out why this is happening. Here is my code for the reverse coding:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;ARRAY&lt;/SPAN&gt; new (&lt;SPAN class="s2"&gt;&lt;STRONG&gt;14&lt;/STRONG&gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P class="p1"&gt;AETS19_09_1nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_10_1nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_11_1nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_12_1nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_13_1nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_14_1nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_15_1nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_09_2nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_10_2nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_11_2nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_12_2nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_13_2nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_14_2nr&lt;/P&gt;&lt;P class="p1"&gt;AETS19_15_2nr;&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;ARRAY&lt;/SPAN&gt; old (&lt;SPAN class="s2"&gt;&lt;STRONG&gt;14&lt;/STRONG&gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P class="p1"&gt;AETS19_09_1n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_10_1n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_11_1n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_12_1n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_13_1n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_14_1n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_15_1n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_09_2n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_10_2n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_11_2n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_12_2n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_13_2n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_14_2n&lt;/P&gt;&lt;P class="p1"&gt;AETS19_15_2n;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Do&lt;/SPAN&gt; i=&lt;SPAN class="s2"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;to&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;&lt;STRONG&gt;14&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;If&lt;/SPAN&gt; old (i) =&lt;SPAN class="s2"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;then&lt;/SPAN&gt; new (i)=&lt;SPAN class="s2"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Else&lt;/SPAN&gt; new (i) = &lt;SPAN class="s2"&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/SPAN&gt; - old (i);&lt;/P&gt;&lt;P class="p3"&gt;END&lt;SPAN class="s3"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;DROP&lt;SPAN class="s3"&gt; I;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;SPAN class="s3"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN class="s3"&gt;Many thanks in advance to anyone who can identify my error!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 21:49:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499722#M133008</guid>
      <dc:creator>amcr729</dc:creator>
      <dc:date>2018-09-27T21:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with code for reverse coding scale items</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499724#M133010</link>
      <description>&lt;P&gt;Could you provide the log, since there is nothing obviously wrong with the code you show, assuming it's part of a data step.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 22:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499724#M133010</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-09-27T22:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with code for reverse coding scale items</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499726#M133012</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;Here is the log -- it shows (1) my recoding special codes (88 and 99) to missing (.) and then (2) the reverse coding code. I had no problem with (1) but am including it here in case that somehow sheds light on the problem with (2).&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Many thanks.&lt;/DIV&gt;</description>
      <pubDate>Thu, 27 Sep 2018 22:23:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499726#M133012</guid>
      <dc:creator>amcr729</dc:creator>
      <dc:date>2018-09-27T22:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with code for reverse coding scale items</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499731#M133015</link>
      <description>&lt;P&gt;You are using the same variables multiple times. The data set IPV is referenced as data IPV; 15 times. So it really isn't very possible to identify where anything is happening.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Provide a small data set with values for just a couple of variables that show the desired behavior similar to&lt;/P&gt;
&lt;PRE&gt;data example;
   input AETS19_09_1n AETS19_10_1n;
datalines;
1 2
3 4
. 1
1 .
. .
;
run;&lt;/PRE&gt;
&lt;P&gt;You might be interesting in knowing that&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;   do i=1 to dim(new);
      new (i) = 5 - old (i);
   END;
&lt;/PRE&gt;
&lt;P&gt;behaves exactly the same as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;   do i=1 to dim(new);
      If old (i) =. then new (i)=.;
      Else new (i) = 5 - old (i);
   END;
&lt;/PRE&gt;
&lt;P&gt;Any addition, subtraction or multiplication involving a missing value results in missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It appears that you tried the above but left an ELSE in the code:&lt;/P&gt;
&lt;PRE&gt;352  Do i=1 to 14;
353  /*If old (i) =. then new (i)=.;*/
354  Else new (i) = 5 - old (i);
     ----
     160
ERROR 160-185: No matching IF-THEN clause.

355  END;
356  DROP I;
357  RUN;&lt;/PRE&gt;
&lt;P&gt;at which point data ipv was not replaced so everything after that is suspect but the proc freq executed at line 359 was run against the data ipv created starting at line 269.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 23:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499731#M133015</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-27T23:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with code for reverse coding scale items</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499734#M133016</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, I sent the wrong log with extraneous stuff. The attached log should be easier to&amp;nbsp; understand.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 23:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499734#M133016</guid>
      <dc:creator>amcr729</dc:creator>
      <dc:date>2018-09-27T23:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with code for reverse coding scale items</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499738#M133018</link>
      <description>&lt;P&gt;And some example data in a data step where AETS19_09_1n is not missing that when you run the code generates missing values for&lt;/P&gt;
&lt;P&gt;AETS19_09_1nr?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 00:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-code-for-reverse-coding-scale-items/m-p/499738#M133018</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-28T00:00:11Z</dc:date>
    </item>
  </channel>
</rss>

