<?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: Does SAS write over initial defined variables if it is defined a second time? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Does-SAS-write-over-initial-defined-variables-if-it-is-defined-a/m-p/733698#M228618</link>
    <description>&lt;P&gt;Data instatus;&lt;/P&gt;
&lt;P&gt;Set ins.set1 ins.set2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Set 1 = 2012 - 2014;&lt;/P&gt;
&lt;P&gt;* Set 2 = 2015 - 2017;&lt;/P&gt;
&lt;P&gt;* YY_STAT&amp;nbsp; = survey year; char var, YYYY format;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Status for Set 1 */&lt;/P&gt;
&lt;P&gt;If work in (1) or comp in (1) then insurance = 1; *work or partner's work;&lt;/P&gt;
&lt;P&gt;If medic in (1) or gov in (1) then insurance = 2; *Medicaid or other government-funded;&lt;/P&gt;
&lt;P&gt;if other in (1) then insurance = 3; *other;&lt;/P&gt;
&lt;P&gt;if none in (1) then insurance = 4; *none;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Set 2 */&lt;/P&gt;
&lt;P&gt;If work4 in (1) or hcech in (1) then insurance = 1; *work or HSA program;&lt;/P&gt;
&lt;P&gt;If medic in (1)&amp;nbsp; then insurance = 2; *Medicaid or other government-funded;&lt;/P&gt;
&lt;P&gt;if other in (1) then insurance = 3; *other;&lt;/P&gt;
&lt;P&gt;if none in (1) then insurance = 4; *none;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Apr 2021 12:07:32 GMT</pubDate>
    <dc:creator>SAS93</dc:creator>
    <dc:date>2021-04-14T12:07:32Z</dc:date>
    <item>
      <title>Does SAS write over initial defined variables if it is defined a second time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-SAS-write-over-initial-defined-variables-if-it-is-defined-a/m-p/733688#M228611</link>
      <description>&lt;P&gt;I don't recall having learned this "directly", but experience seems to point that it does. I just wanted to clarification on it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been using SAS to group a series of Y/N survey response variables into a single categorical variable for defining a respondent's insurance status.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've been doing this for a single set of years (example: Set 1 = 2012 - 2014, Set 2 = 2015 - 2017). Each set has mostly the same variable names, except Set 1 has a few additional variables that Set 2 doesn't have, and one that is named differently.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;/* Set 1 */&lt;/P&gt;
&lt;P&gt;If work in (1) or comp in (1) then insurance = 1; *work or partner's work;&lt;/P&gt;
&lt;P&gt;If medic in (1) or gov in (1) then insurance = 2; *Medicaid or other government-funded;&lt;/P&gt;
&lt;P&gt;if other in (1) then insurance = 3; *other;&lt;/P&gt;
&lt;P&gt;if none in (1) then insurance = 4; *none;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Set 2 */&lt;/P&gt;
&lt;P&gt;If work4 in (1) or hcech in (1) then insurance = 1; *work or healthcare exchange program;&lt;/P&gt;
&lt;P&gt;If medic in (1)&amp;nbsp; then insurance = 2; *Medicaid or other government-funded;&lt;/P&gt;
&lt;P&gt;if other in (1) then insurance = 3; *other;&lt;/P&gt;
&lt;P&gt;if none in (1) then insurance = 4; *none;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I ask because--when run the Set 1 and Set 2 datasets separately with their respective codes, I always get the same numbers for Set 2 regardless of running separately or combined with Set 1, but Set 1 is always different depending on how I run it. I just wanted to confirm that this "overwriting" is what was happening.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 11:30:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-SAS-write-over-initial-defined-variables-if-it-is-defined-a/m-p/733688#M228611</guid>
      <dc:creator>SAS93</dc:creator>
      <dc:date>2021-04-14T11:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Does SAS write over initial defined variables if it is defined a second time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-SAS-write-over-initial-defined-variables-if-it-is-defined-a/m-p/733691#M228613</link>
      <description>&lt;P&gt;Please post your complete data step code, so we know how you read the datasets.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 11:33:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-SAS-write-over-initial-defined-variables-if-it-is-defined-a/m-p/733691#M228613</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-14T11:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Does SAS write over initial defined variables if it is defined a second time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-SAS-write-over-initial-defined-variables-if-it-is-defined-a/m-p/733698#M228618</link>
      <description>&lt;P&gt;Data instatus;&lt;/P&gt;
&lt;P&gt;Set ins.set1 ins.set2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Set 1 = 2012 - 2014;&lt;/P&gt;
&lt;P&gt;* Set 2 = 2015 - 2017;&lt;/P&gt;
&lt;P&gt;* YY_STAT&amp;nbsp; = survey year; char var, YYYY format;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Status for Set 1 */&lt;/P&gt;
&lt;P&gt;If work in (1) or comp in (1) then insurance = 1; *work or partner's work;&lt;/P&gt;
&lt;P&gt;If medic in (1) or gov in (1) then insurance = 2; *Medicaid or other government-funded;&lt;/P&gt;
&lt;P&gt;if other in (1) then insurance = 3; *other;&lt;/P&gt;
&lt;P&gt;if none in (1) then insurance = 4; *none;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Set 2 */&lt;/P&gt;
&lt;P&gt;If work4 in (1) or hcech in (1) then insurance = 1; *work or HSA program;&lt;/P&gt;
&lt;P&gt;If medic in (1)&amp;nbsp; then insurance = 2; *Medicaid or other government-funded;&lt;/P&gt;
&lt;P&gt;if other in (1) then insurance = 3; *other;&lt;/P&gt;
&lt;P&gt;if none in (1) then insurance = 4; *none;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 12:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-SAS-write-over-initial-defined-variables-if-it-is-defined-a/m-p/733698#M228618</guid>
      <dc:creator>SAS93</dc:creator>
      <dc:date>2021-04-14T12:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Does SAS write over initial defined variables if it is defined a second time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-SAS-write-over-initial-defined-variables-if-it-is-defined-a/m-p/733700#M228620</link>
      <description>&lt;P&gt;The variable insurance exists only once in the PDV, so all those statements will have an effect on it.&lt;/P&gt;
&lt;P&gt;If medic and other are both 1, then insurance = 3 will "overwrite" insurance = 2, simply because the test for other comes after the test for medic.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 12:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-SAS-write-over-initial-defined-variables-if-it-is-defined-a/m-p/733700#M228620</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-14T12:26:04Z</dc:date>
    </item>
  </channel>
</rss>

