<?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: Every combination of  categorical variables into new variable using IF THEN in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592520#M169903</link>
    <description>&lt;P&gt;You are absolutely correct, wow I cannot believe it was that simple. Thank you so much.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 29 Sep 2019 23:47:57 GMT</pubDate>
    <dc:creator>aowusudommey</dc:creator>
    <dc:date>2019-09-29T23:47:57Z</dc:date>
    <item>
      <title>Every combination of  categorical variables into new variable using IF THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592510#M169894</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having an issue that I hope you can help with.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have a very large dataset with multiple variables that I need to combine into various categories.&lt;/P&gt;&lt;P&gt;I've attempted this way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF (var1=1 and var2=1 and var3=1 and var4=1 and var5=1 and var6=1) OR&lt;/P&gt;&lt;P&gt;(var1=1 and var2=1 and var3=1 and var4=1 and var5=1 and var7=1) OR&lt;/P&gt;&lt;P&gt;(var1=1 and var2=1 and var3=1 and var4=1 and var5=1 and var8=1) OR&lt;/P&gt;&lt;P&gt;(var2=1 and var3=1 and var4=1 and var5=1 and var6=1 and var7=1) OR......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THEN combo6=1, else combo6=0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, this process has been tedious, and not very effective as the combinations i'm getting equal more than the data I have available. Does anyone have any idea how to accomplish this?&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2019 22:55:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592510#M169894</guid>
      <dc:creator>aowusudommey</dc:creator>
      <dc:date>2019-09-29T22:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Every combination of  categorical variables into new variable using IF THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592512#M169895</link>
      <description>&lt;P&gt;Forget SAS for a second. What is the logical rule that you are trying to program? Please explain.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2019 23:05:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592512#M169895</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-29T23:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Every combination of  categorical variables into new variable using IF THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592513#M169896</link>
      <description>&lt;P&gt;Sure. The logic rule I'm attempting to follow is pretty simple, but hard to describe in text. Essentially, we have A, B, C, D, E, F, G, and H. What I need is all of the combinations of these letters in sets of 8, 7, 6, 5, and 4.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;(A,B,C,D)=combo4&lt;/P&gt;&lt;P&gt;(B,C,D,E)=combo4&lt;/P&gt;&lt;P&gt;(C,D,E,F)=combo4&lt;/P&gt;&lt;P&gt;and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the dataset given to me is categorical. I only want the variables that are "yes" (A=1, B=1, etc), included in the new variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;8 is easy, but the remaining get complicated. Did that clarify at all?&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2019 23:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592513#M169896</guid>
      <dc:creator>aowusudommey</dc:creator>
      <dc:date>2019-09-29T23:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Every combination of  categorical variables into new variable using IF THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592514#M169897</link>
      <description>&lt;P&gt;Based on your incomplete explanation&amp;nbsp;a statement like this may be helpful.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;combo6= (sum(of var1 - var8) = 6);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2019 23:18:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592514#M169897</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-09-29T23:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Every combination of  categorical variables into new variable using IF THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592515#M169898</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292313"&gt;@aowusudommey&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Sure. The logic rule I'm attempting to follow is pretty simple, but hard to describe in text. Essentially, we have A, B, C, D, E, F, G, and H. What I need is all of the combinations of these letters in sets of 8, 7, 6, 5, and 4.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;(A,B,C,D)=combo4&lt;/P&gt;
&lt;P&gt;(B,C,D,E)=combo4&lt;/P&gt;
&lt;P&gt;(C,D,E,F)=combo4&lt;/P&gt;
&lt;P&gt;and so on.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the dataset given to me is categorical. I only want the variables that are "yes" (A=1, B=1, etc), included in the new variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;8 is easy, but the remaining get complicated. Did that clarify at all?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;May we assume that if A is not equal to 1, then it must be zero?&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2019 23:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592515#M169898</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-29T23:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Every combination of  categorical variables into new variable using IF THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592516#M169899</link>
      <description>&lt;P&gt;That is correct, each variable is assigned a value of either 1 or 0, there are no missing values.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2019 23:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592516#M169899</guid>
      <dc:creator>aowusudommey</dc:creator>
      <dc:date>2019-09-29T23:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Every combination of  categorical variables into new variable using IF THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592517#M169900</link>
      <description>&lt;P&gt;I am unfortunately not looking for a sum, I'm looking to have every possible combination of these 8 binary variables to be assigned to a new variable. So that, for example, every combination of 6 of the 8 variables would equal combo6, every combination of 5 of the 8 variables would equal combo5, and so on. I'm very sorry, I am not able to give exact information without violating a privacy agreement.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2019 23:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592517#M169900</guid>
      <dc:creator>aowusudommey</dc:creator>
      <dc:date>2019-09-29T23:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: Every combination of  categorical variables into new variable using IF THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592518#M169901</link>
      <description>&lt;P&gt;So sorry, I should further explain that I would need any variable in the string that is equal 0 to cause the entire row to be equal to zero.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(A=1 and B=1 and C=1 and D=1), then combo4=1&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;However:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(A=1 and B=1 and C=1 and D=0) then combo4=0&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2019 23:34:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592518#M169901</guid>
      <dc:creator>aowusudommey</dc:creator>
      <dc:date>2019-09-29T23:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Every combination of  categorical variables into new variable using IF THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592519#M169902</link>
      <description>&lt;P&gt;But summing any combination of 8 binary variables where the total is 6 will give you one of your answers - combo6?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var1 = 1 plus var2 = 1 plus var3 = 1 plus var4 = 1 plus var5 = 1 plus var6 = 1 equals 6.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2019 23:44:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592519#M169902</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-09-29T23:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Every combination of  categorical variables into new variable using IF THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592520#M169903</link>
      <description>&lt;P&gt;You are absolutely correct, wow I cannot believe it was that simple. Thank you so much.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2019 23:47:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Every-combination-of-categorical-variables-into-new-variable/m-p/592520#M169903</guid>
      <dc:creator>aowusudommey</dc:creator>
      <dc:date>2019-09-29T23:47:57Z</dc:date>
    </item>
  </channel>
</rss>

