<?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: Combining multiple variables into new dummy variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549631#M152532</link>
    <description>&lt;P&gt;Yes, I should have clarified that! I created each variable with a state name from an original variable, _STATE, which coded each state according to a number. So, now that you point that out, I should probably go back to the original variable to make the Medicaid variable. Perhaps something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Medicaid = 0;&lt;/P&gt;&lt;P&gt;if _STATE = (1, 2, 3) then Medicaid = 1;&lt;/P&gt;&lt;P&gt;if _STATE = (4, 5, 6) then Medicaid = 0;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Apr 2019 14:56:18 GMT</pubDate>
    <dc:creator>smallembo</dc:creator>
    <dc:date>2019-04-09T14:56:18Z</dc:date>
    <item>
      <title>Combining multiple variables into new dummy variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549601#M152519</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a relatively new SAS user so I'm not sure how to do this but it seems like it should be possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have variables for all 50 states and want to split them into a new variable depending on whether or not they have expanded Medicaid coverage or not. Then, I want to be able to make the Medicaid variable into a binary 0/1 in order to run a diff-in-diff model. Is that possible? In my head it would look something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ACAyes = (Arizona, Arkansas, California); &amp;nbsp;&lt;/P&gt;&lt;P&gt;ACAno = (Alabama, Florida, Georgia);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Medicaid = 0;&lt;/P&gt;&lt;P&gt;if ACAyes = 1 then Medicaid = 1;&lt;/P&gt;&lt;P&gt;if ACAno = 1 then Medicaid = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 13:46:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549601#M152519</guid>
      <dc:creator>smallembo</dc:creator>
      <dc:date>2019-04-09T13:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple variables into new dummy variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549604#M152520</link>
      <description>&lt;P&gt;So just to be clear, you have variables named&amp;nbsp;&lt;SPAN&gt;Arizona, Arkansas, California and so on, correct? What do those variables contain?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 13:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549604#M152520</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-04-09T13:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple variables into new dummy variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549631#M152532</link>
      <description>&lt;P&gt;Yes, I should have clarified that! I created each variable with a state name from an original variable, _STATE, which coded each state according to a number. So, now that you point that out, I should probably go back to the original variable to make the Medicaid variable. Perhaps something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Medicaid = 0;&lt;/P&gt;&lt;P&gt;if _STATE = (1, 2, 3) then Medicaid = 1;&lt;/P&gt;&lt;P&gt;if _STATE = (4, 5, 6) then Medicaid = 0;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 14:56:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549631#M152532</guid>
      <dc:creator>smallembo</dc:creator>
      <dc:date>2019-04-09T14:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple variables into new dummy variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549639#M152535</link>
      <description>&lt;P&gt;Coding:&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;if _STATE = (1, 2, 3)&lt;/SPAN&gt;&lt;/STRONG&gt; is wrong sas syntax. what you mean is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;if _STATE in (1&amp;nbsp; 2&amp;nbsp; 3) then&amp;nbsp;Medicaid = 1; else&amp;nbsp;Medicaid = 0;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;assuming that (1 2 3) are the only those with&amp;nbsp;Medicaid = 1;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 15:10:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549639#M152535</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-04-09T15:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple variables into new dummy variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549666#M152548</link>
      <description>&lt;P&gt;Ah, thank you for pointing out my syntax. As far as the if/else statement, there are a few states and territories in the original _STATE variable that I don’t want to be in either grouping and want them to be disregarded for the diff-in-diff model. How would you suggest I code the statement so that the states I want to disregard don’t wind up in the model? Would it work to sssign them to another number?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 15:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549666#M152548</guid>
      <dc:creator>smallembo</dc:creator>
      <dc:date>2019-04-09T15:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple variables into new dummy variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549668#M152550</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;As far as the if/else statement, there are a few states and territories in the original _STATE variable that I don’t want to be in either grouping and want them to be disregarded for the diff-in-diff model.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your data step or PROC, if for example you don't want states 5 and 27 in the analysis, then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where state not in (5,27);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 09 Apr 2019 15:40:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/549668#M152550</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-09T15:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple variables into new dummy variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/550343#M152791</link>
      <description>&lt;P&gt;Thank you! Can I ask one more question? I have tried this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data newCOMBO where _STATE not in (2 22 23 49 51 66 72 78);&lt;BR /&gt;set COMBO;&lt;BR /&gt;Medicaid = 0;&lt;BR /&gt;if _STATE = (4 5 6 8 9 10 11 15 17 18 19 21 24 25 26 27 30 31 32 33 34 35 36 38 39 41 42 44 50 53 54) then Medicaid = 1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But keep running into these errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WARNING: The data set WORK.NEWCOMBO may be incomplete. When this step was stopped there were 0&lt;BR /&gt;observations and 160 variables.&lt;BR /&gt;WARNING: The data set WORK.WHERE may be incomplete. When this step was stopped there were 0&lt;BR /&gt;observations and 160 variables.&lt;BR /&gt;WARNING: Data set WORK.WHERE was not replaced because this step was stopped.&lt;BR /&gt;WARNING: The data set WORK._STATE may be incomplete. When this step was stopped there were 0&lt;BR /&gt;observations and 160 variables.&lt;BR /&gt;WARNING: Data set WORK._STATE was not replaced because this step was stopped.&lt;BR /&gt;WARNING: The data set WORK.NOT may be incomplete. When this step was stopped there were 0&lt;BR /&gt;observations and 160 variables.&lt;BR /&gt;WARNING: Data set WORK.NOT was not replaced because this step was stopped.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything works fine up until this point so I'm thinking this step is definitely written wrong.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 17:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/550343#M152791</guid>
      <dc:creator>smallembo</dc:creator>
      <dc:date>2019-04-11T17:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple variables into new dummy variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/550344#M152792</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if _STATE &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;in&lt;/STRONG&gt;&lt;/FONT&gt; (4 5 6 8 9 10 11 15 17 18 19 21 24 25 26 27 
    30 31 32 33 34 35 36 38 39 41 42 44 50 53 54) then Medicaid = 1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Apr 2019 17:24:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/550344#M152792</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-11T17:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple variables into new dummy variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/550347#M152794</link>
      <description>&lt;P&gt;Ack, thank you!!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 17:40:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-multiple-variables-into-new-dummy-variable/m-p/550347#M152794</guid>
      <dc:creator>smallembo</dc:creator>
      <dc:date>2019-04-11T17:40:32Z</dc:date>
    </item>
  </channel>
</rss>

