<?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 how to rename a numeric variable with multiple choice answers ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/556906#M155185</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to rename 5 variables A B C D E (that were selected yes = 1 no = 0) to become one variable X with key values of 1-5 BUT we can have multiple values.&lt;/P&gt;&lt;P&gt;So X can be a 1 or 1,2 or 2 or 1,2,3 or 3 or 1,2,3,4 or 4 or 1,2,3,4,5 or 5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I thought of doing this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if A =&lt;STRONG&gt;1&lt;/STRONG&gt; then X =&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if B= &lt;STRONG&gt;1&lt;/STRONG&gt; then X =&lt;STRONG&gt;2&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if C =&lt;STRONG&gt;1&lt;/STRONG&gt; then X =&lt;STRONG&gt;3&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if D then X =&lt;STRONG&gt;4&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if E= &lt;STRONG&gt;1&lt;/STRONG&gt; then X =&lt;STRONG&gt;5&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;if (A =&lt;STRONG&gt;1&lt;/STRONG&gt; and B = &lt;STRONG&gt;1&lt;/STRONG&gt;) then X=&lt;STRONG&gt;1,2&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if (A =&lt;STRONG&gt;1&lt;/STRONG&gt; and B = &lt;STRONG&gt;1&lt;/STRONG&gt; C =&lt;STRONG&gt;1&lt;/STRONG&gt;) then X=&lt;STRONG&gt;1,2,3&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if (A =&lt;STRONG&gt;1&lt;/STRONG&gt; and B= &lt;STRONG&gt;1&lt;/STRONG&gt; and C =&lt;STRONG&gt;1&lt;/STRONG&gt; and D=&lt;STRONG&gt;1&lt;/STRONG&gt;) then X =&lt;STRONG&gt;1,2&lt;/STRONG&gt;,&lt;STRONG&gt;3,4&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if (A =&lt;STRONG&gt;1&lt;/STRONG&gt; and B = &lt;STRONG&gt;1&lt;/STRONG&gt; and C=&lt;STRONG&gt;1&lt;/STRONG&gt; and D=&lt;STRONG&gt;1&lt;/STRONG&gt; and E= &lt;STRONG&gt;1&lt;/STRONG&gt;) then&lt;/P&gt;&lt;P&gt;X=&lt;STRONG&gt;1,2,3,4,5&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but this does not work. Error message:&amp;nbsp; Expecting an arithmetic operator (where the commas were added)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I changed the comma with the word and. It "works" but it keeps only one of the values.&lt;/P&gt;&lt;P&gt;so in&amp;nbsp;&amp;nbsp;if (A =&lt;STRONG&gt;1&lt;/STRONG&gt; and B= &lt;STRONG&gt;1&lt;/STRONG&gt; and C =&lt;STRONG&gt;1&lt;/STRONG&gt; and D=&lt;STRONG&gt;1&lt;/STRONG&gt;) then X =&lt;STRONG&gt;1 and 2&lt;/STRONG&gt;, &lt;STRONG&gt;and&lt;/STRONG&gt; &lt;STRONG&gt;3&lt;/STRONG&gt; &lt;STRONG&gt;and&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;4&lt;/STRONG&gt;;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It keeps only one value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I have an array instead ? And if so, how can I tell sas to keep all the values when needed ?&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 May 2019 18:23:34 GMT</pubDate>
    <dc:creator>Mscarboncopy</dc:creator>
    <dc:date>2019-05-07T18:23:34Z</dc:date>
    <item>
      <title>how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/556906#M155185</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to rename 5 variables A B C D E (that were selected yes = 1 no = 0) to become one variable X with key values of 1-5 BUT we can have multiple values.&lt;/P&gt;&lt;P&gt;So X can be a 1 or 1,2 or 2 or 1,2,3 or 3 or 1,2,3,4 or 4 or 1,2,3,4,5 or 5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I thought of doing this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if A =&lt;STRONG&gt;1&lt;/STRONG&gt; then X =&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if B= &lt;STRONG&gt;1&lt;/STRONG&gt; then X =&lt;STRONG&gt;2&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if C =&lt;STRONG&gt;1&lt;/STRONG&gt; then X =&lt;STRONG&gt;3&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if D then X =&lt;STRONG&gt;4&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if E= &lt;STRONG&gt;1&lt;/STRONG&gt; then X =&lt;STRONG&gt;5&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;if (A =&lt;STRONG&gt;1&lt;/STRONG&gt; and B = &lt;STRONG&gt;1&lt;/STRONG&gt;) then X=&lt;STRONG&gt;1,2&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if (A =&lt;STRONG&gt;1&lt;/STRONG&gt; and B = &lt;STRONG&gt;1&lt;/STRONG&gt; C =&lt;STRONG&gt;1&lt;/STRONG&gt;) then X=&lt;STRONG&gt;1,2,3&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if (A =&lt;STRONG&gt;1&lt;/STRONG&gt; and B= &lt;STRONG&gt;1&lt;/STRONG&gt; and C =&lt;STRONG&gt;1&lt;/STRONG&gt; and D=&lt;STRONG&gt;1&lt;/STRONG&gt;) then X =&lt;STRONG&gt;1,2&lt;/STRONG&gt;,&lt;STRONG&gt;3,4&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if (A =&lt;STRONG&gt;1&lt;/STRONG&gt; and B = &lt;STRONG&gt;1&lt;/STRONG&gt; and C=&lt;STRONG&gt;1&lt;/STRONG&gt; and D=&lt;STRONG&gt;1&lt;/STRONG&gt; and E= &lt;STRONG&gt;1&lt;/STRONG&gt;) then&lt;/P&gt;&lt;P&gt;X=&lt;STRONG&gt;1,2,3,4,5&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but this does not work. Error message:&amp;nbsp; Expecting an arithmetic operator (where the commas were added)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I changed the comma with the word and. It "works" but it keeps only one of the values.&lt;/P&gt;&lt;P&gt;so in&amp;nbsp;&amp;nbsp;if (A =&lt;STRONG&gt;1&lt;/STRONG&gt; and B= &lt;STRONG&gt;1&lt;/STRONG&gt; and C =&lt;STRONG&gt;1&lt;/STRONG&gt; and D=&lt;STRONG&gt;1&lt;/STRONG&gt;) then X =&lt;STRONG&gt;1 and 2&lt;/STRONG&gt;, &lt;STRONG&gt;and&lt;/STRONG&gt; &lt;STRONG&gt;3&lt;/STRONG&gt; &lt;STRONG&gt;and&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;4&lt;/STRONG&gt;;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It keeps only one value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I have an array instead ? And if so, how can I tell sas to keep all the values when needed ?&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 18:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/556906#M155185</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2019-05-07T18:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/556911#M155187</link>
      <description>&lt;P&gt;More than likely, you are better off doing nothing.&amp;nbsp; Your data is fine as it stands now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to change it, you first have to decide on the values for X.&amp;nbsp; If X is going to be a number, you can only store a number in it (not a set of numbers).&amp;nbsp; So what number should represent A and B both 1?&amp;nbsp; Or would you prefer that X be a character string?&amp;nbsp; At any rate, it's up to you to decide what the mapping should be between ABCDE and X.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 18:34:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/556911#M155187</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-05-07T18:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/556914#M155189</link>
      <description>&lt;P&gt;You could store the values into a single character string.&amp;nbsp; Or make a number using powers of 2.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input a b c d e ;
  length char $5 ;
  char = cats(of a b c d e);
  number=input(char,binary5.);
cards;
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
0 0 0 0 0
1 0 1 0 0
0 0 0 1 1
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    a    b    c    d    e    char     number

 1     1    0    0    0    0    10000      16
 2     0    1    0    0    0    01000       8
 3     0    0    1    0    0    00100       4
 4     0    0    0    1    0    00010       2
 5     0    0    0    0    1    00001       1
 6     0    0    0    0    0    00000       0
 7     1    0    1    0    0    10100      20
 8     0    0    0    1    1    00011       3&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 May 2019 18:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/556914#M155189</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-07T18:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/556916#M155190</link>
      <description>X = catx(', ', A, B, C, D, E)</description>
      <pubDate>Tue, 07 May 2019 19:01:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/556916#M155190</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-07T19:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/556936#M155202</link>
      <description>&lt;P&gt;Just for giggles, exactly what analysis, use&amp;nbsp;or reporting are you going to do on this X variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh, are any of the A, B, etc &lt;STRONG&gt;ever&lt;/STRONG&gt; missing? If so, how do you want to use that information?&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>Tue, 07 May 2019 20:48:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/556936#M155202</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-07T20:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557073#M155252</link>
      <description>&lt;P&gt;I agree... but it was not my decision. So now&amp;nbsp; I have 2 data sets - one with the variables a b c d and e and another with X (and key values all in X representing ABCDE)&lt;/P&gt;&lt;P&gt;And X is supposed to be numeric, so I can't change it to a string.&lt;/P&gt;&lt;P&gt;I think I will do what you suggested, create a number for the combinations AB - AC - AD - AE then BC BD BE and CD CE and DE and all the other combinations as I gave in my example.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 12:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557073#M155252</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2019-05-08T12:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557077#M155254</link>
      <description>&lt;P&gt;They are not ever missing (it is either 1 or 0,&amp;nbsp; 0 is not "missing" instead it is "source not used"). This variable is giving information about "sources" of documents used in one of our data sets.&lt;/P&gt;&lt;P&gt;So we can have all 5 sources or any combination of the 5, including only one, but X is never missing, we have to have at least one source for each data entry.&lt;/P&gt;&lt;P&gt;All we want to know is the frequency of "sources" we have in our data, what is the source most used.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 12:18:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557077#M155254</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2019-05-08T12:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557096#M155259</link>
      <description>&lt;P&gt;Now I have another question. If I am creating values for the combinations (as I think is the best solution), my second data file that has only one Var X with multiple numbers must also be renamed (with the keys that would correspond to the combinations).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sas is saying that X has an incorrect numeric variable for the entries (obs) with 1,3 or 2,3 and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The renaming commands below do not work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (X =1 and X= 2) then X=6;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if x=1,2 then x=6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sas does not recognize 1,2 as a correct number or the way I broke it apart in the first example.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would an array work better here then ? If so, how can I work with these values separated by commas in var X?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My second data set looks like this (in SPSS):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs&amp;nbsp; VAR X&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1,3&lt;BR /&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2,5&lt;BR /&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1,2,3,4&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1,3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and it needs to look like&lt;/P&gt;&lt;P&gt;Obs&amp;nbsp; VAR X&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7&lt;BR /&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15&lt;BR /&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;11&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 13:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557096#M155259</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2019-05-08T13:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557198#M155299</link>
      <description>Do you need a decimal number? Tom's solution shows a method to generate a unique number for each combination already, the number variable which will be unique for every combination because of the way binary values work. Test it out.</description>
      <pubDate>Wed, 08 May 2019 17:26:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557198#M155299</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-08T17:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557200#M155300</link>
      <description>&lt;P&gt;Yes... I thought of that also, but the example he gave was for variables a b c d e (my original question)&lt;/P&gt;&lt;P&gt;I need to do this for only one variable now - and that is&amp;nbsp;variable X that has multiple values 1 to 5.&lt;/P&gt;&lt;P&gt;I am not sure how to adapt his suggestion to this new scenario.&amp;nbsp;&lt;/P&gt;&lt;P&gt;a b c d e are not variables in this case, I have values 1 2 3 4 5 but all in one variable X that must be separated first and then renamed into a new value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 17:32:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557200#M155300</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2019-05-08T17:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557201#M155301</link>
      <description>Why not back up a step and do it in the same step while you have the ABCDE variables or separate them out again using a loop and array, with SCAN().</description>
      <pubDate>Wed, 08 May 2019 17:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557201#M155301</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-08T17:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557207#M155302</link>
      <description>&lt;P&gt;They are in 2 different data sets so they are independent (the file that has the different 5 variables AND the file that has one var X with 5 key values). I am trying to rename&amp;nbsp; them both as one VAR X (because they are the same variable, only collected differently) and I need to do this so the variable X in the those 2 files match and I can merge them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would I &lt;SPAN&gt;separate the values out of X using a loop and array, with SCAN() ?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That is what I am thinking I need to do, but I've never done this before.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you !&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 17:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557207#M155302</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2019-05-08T17:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557216#M155303</link>
      <description>&lt;P&gt;So 1,2 is NOT A number.&amp;nbsp; As a concept it is a list of numbers but it is not A number so it cannot be stored into a single numeric field.&amp;nbsp; The only way you have values like that in SAS is by storing it as a string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input string_x $20.;
cards;
3
1,3
2,5
1,2,3,4
1
1,3
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You seem to want to create a new NUMBER that can map the string.&lt;/P&gt;
&lt;P&gt;Why to you want a number?&amp;nbsp; The number would just represent the string and probably in a much less clear way.&lt;/P&gt;
&lt;P&gt;You are never going to use it as a number.&amp;nbsp; You could not do arithmetic with the numbers that represents 1,2,3,4 and the number that represents 1,3.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There might be some value in converting the list of numbers back into the 0/1 boolean numbers you had before.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have;
  array flags flag1-flag5 ;
  do i=1 to dim(flags);
    if findw(string_x,cats(i),',','sit') then flags[i]=1;
    else flags[i]=0;
  end;
  drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;Obs    string_x    flag1    flag2    flag3    flag4    flag5

 1     3             0        0        1        0        0
 2     1,3           1        0        1        0        0
 3     2,5           0        1        0        0        1
 4     1,2,3,4       1        1        1        1        0
 5     1             1        0        0        0        0
 6     1,3           1        0        1        0        0&lt;/PRE&gt;
&lt;P&gt;Or you could convert it into multiple observations. Then you could have a numeric variable since any single observation would store only one number.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want2;
  set have; 
  do flag_no=1 to countw(string_x,',');
    flag = input(scan(string_x,flag_no,','),32.);
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;Obs    string_x    flag_no    flag

  1    3              1         3
  2    1,3            1         1
  3    1,3            2         3
  4    2,5            1         2
  5    2,5            2         5
  6    1,2,3,4        1         1
  7    1,2,3,4        2         2
  8    1,2,3,4        3         3
  9    1,2,3,4        4         4
 10    1              1         1
 11    1,3            1         1
 12    1,3            2         3&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 18:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557216#M155303</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-08T18:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557278#M155317</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/210474"&gt;@Mscarboncopy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;They are not ever missing (it is either 1 or 0,&amp;nbsp; 0 is not "missing" instead it is "source not used"). This variable is giving information about "sources" of documents used in one of our data sets.&lt;/P&gt;
&lt;P&gt;So we can have all 5 sources or any combination of the 5, including only one, but X is never missing, we have to have at least one source for each data entry.&lt;/P&gt;
&lt;P&gt;All we want to know is the frequency of "sources" we have in our data, what is the source most used.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The sum of each of your variables A to E is the number of times it is used as source. So perhaps NOTHING is needed to answer that question except a summary procedure that will some those values.&lt;/P&gt;
&lt;PRE&gt;data test;
  input a b c d e ;
  length char $5 ;
  char = cats(of a b c d e);
  number=input(char,binary5.);
cards;
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
0 0 0 0 0
1 0 1 0 0
0 0 0 1 1
;

proc means data=test sum;
var a b c d e;
run;&lt;/PRE&gt;
&lt;P&gt;If you have other variables that you need to consider groups such as "agency" or "topic" or similar, those variables would go into a CLASS statement.&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 20:13:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557278#M155317</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-08T20:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to rename a numeric variable with multiple choice answers ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557316#M155340</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;The flags work well for what I want to do.&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 22:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-rename-a-numeric-variable-with-multiple-choice-answers/m-p/557316#M155340</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2019-05-08T22:58:02Z</dc:date>
    </item>
  </channel>
</rss>

