<?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: Changing Variable Output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Changing-Variable-Output/m-p/665817#M199135</link>
    <description>&lt;P&gt;If you examine the properties of the variable Ethnicity1 you will find that it has a length of one character and so cannot accept the second character. Format does not control length, only display appearance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the first use of a character variable is an assignment such as your Ethnicity1=''; that will set the length of the variable. You need to specify a length before use if want it to hold longer values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length Ethnicity1 $ 2 ;&lt;/P&gt;
&lt;P&gt;BEFORE the assignment code you are using.&lt;/P&gt;
&lt;P&gt;If you want multiple values treated the same you can use the IN operator&lt;/P&gt;
&lt;PRE&gt;if hisp_not='.' then ethnicity1='';
if hisp_not='1' then ethnicity1='';

/* can be replaced with*/
if hisp_not in ('.' '1' ) then ethnicity1='';&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jun 2020 16:41:26 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-06-29T16:41:26Z</dc:date>
    <item>
      <title>Changing Variable Output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Variable-Output/m-p/665816#M199134</link>
      <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a new variable in a data step. The code is below:&lt;/P&gt;&lt;P&gt;if hisp_not='.' then ethnicity1='';&lt;BR /&gt;if hisp_not='1' then ethnicity1='';&lt;BR /&gt;if hisp_not='0' then ethnicity1='E1';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run a proc print of var ethnicity1 the output has changed to "E".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="elli444_0-1593444321573.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46767iBAB27449DEDD8AF3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="elli444_0-1593444321573.png" alt="elli444_0-1593444321573.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is essential for the output data to be E1 in order to import into our database.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked and the format is $4 so it's not a formatting issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any idea why this would happen and how to fix it?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 15:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Variable-Output/m-p/665816#M199134</guid>
      <dc:creator>elli444</dc:creator>
      <dc:date>2020-06-29T15:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Variable Output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Variable-Output/m-p/665817#M199135</link>
      <description>&lt;P&gt;If you examine the properties of the variable Ethnicity1 you will find that it has a length of one character and so cannot accept the second character. Format does not control length, only display appearance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the first use of a character variable is an assignment such as your Ethnicity1=''; that will set the length of the variable. You need to specify a length before use if want it to hold longer values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length Ethnicity1 $ 2 ;&lt;/P&gt;
&lt;P&gt;BEFORE the assignment code you are using.&lt;/P&gt;
&lt;P&gt;If you want multiple values treated the same you can use the IN operator&lt;/P&gt;
&lt;PRE&gt;if hisp_not='.' then ethnicity1='';
if hisp_not='1' then ethnicity1='';

/* can be replaced with*/
if hisp_not in ('.' '1' ) then ethnicity1='';&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 16:41:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Variable-Output/m-p/665817#M199135</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-29T16:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Variable Output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Variable-Output/m-p/665832#M199136</link>
      <description>is your variable hisp_not numeric or character?</description>
      <pubDate>Mon, 29 Jun 2020 16:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Variable-Output/m-p/665832#M199136</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-06-29T16:10:34Z</dc:date>
    </item>
  </channel>
</rss>

