<?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 Prevent Truncation of Variable Name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Prevent-Truncation-of-Variable-Name/m-p/568963#M160263</link>
    <description>&lt;P&gt;I have a data step that has the following format:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data in (keep= x y z);
set have; 
if x='today' and y ='tomorrow'; 
parameter  = ''; 
if var1 = 'Good' then var = 1;
    	else if var1 = 'Bad' then var = 2;
    	else if var = 0; &lt;BR /&gt;var1 = x; 
run; &lt;/PRE&gt;&lt;P&gt;When I run this, my var1 output becomes truncated like the following:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var1    x
  t     today
  y  yesterday 
  e    earlier 
         &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have tried inserting a line to define the length:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length parameter $20 var1 $50;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But this didn't fix the issue. Is there anyway I can resolve this?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jun 2019 00:24:06 GMT</pubDate>
    <dc:creator>serena13lee</dc:creator>
    <dc:date>2019-06-26T00:24:06Z</dc:date>
    <item>
      <title>Prevent Truncation of Variable Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-Truncation-of-Variable-Name/m-p/568963#M160263</link>
      <description>&lt;P&gt;I have a data step that has the following format:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data in (keep= x y z);
set have; 
if x='today' and y ='tomorrow'; 
parameter  = ''; 
if var1 = 'Good' then var = 1;
    	else if var1 = 'Bad' then var = 2;
    	else if var = 0; &lt;BR /&gt;var1 = x; 
run; &lt;/PRE&gt;&lt;P&gt;When I run this, my var1 output becomes truncated like the following:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var1    x
  t     today
  y  yesterday 
  e    earlier 
         &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have tried inserting a line to define the length:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length parameter $20 var1 $50;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But this didn't fix the issue. Is there anyway I can resolve this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 00:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-Truncation-of-Variable-Name/m-p/568963#M160263</guid>
      <dc:creator>serena13lee</dc:creator>
      <dc:date>2019-06-26T00:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Truncation of Variable Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-Truncation-of-Variable-Name/m-p/568967#M160264</link>
      <description>&lt;P&gt;They is nothing in that code that would define VAR1 as length $1.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does VAR1 already exist in the input dataset, HAVE?&lt;/P&gt;
&lt;P&gt;If so it perhaps have a format attached to it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Set the length BEFORE pulling the dataset.&amp;nbsp; You cannot change the length of character variable after it has already been set.&lt;/P&gt;
&lt;P&gt;Then remove any format that might be attached to it.&amp;nbsp; In fact why not just remove any formats attached to any of your character variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data in (keep= x y z);
  length parameter $20 var1 $50;
  set have; 
  ....
  format _character_ ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jun 2019 00:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-Truncation-of-Variable-Name/m-p/568967#M160264</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-26T00:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Truncation of Variable Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-Truncation-of-Variable-Name/m-p/569003#M160281</link>
      <description>&lt;P&gt;Lines 2 and 3 can NOT have come from your code, as you have a subsetting if on x = "today".&lt;/P&gt;
&lt;P&gt;Please show an example for dataset have, the code you actually ran and the result from that specific run.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 07:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-Truncation-of-Variable-Name/m-p/569003#M160281</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-26T07:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Truncation of Variable Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-Truncation-of-Variable-Name/m-p/569298#M160415</link>
      <description>Thanks! That was exactly what I needed.</description>
      <pubDate>Wed, 26 Jun 2019 21:53:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-Truncation-of-Variable-Name/m-p/569298#M160415</guid>
      <dc:creator>serena13lee</dc:creator>
      <dc:date>2019-06-26T21:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Truncation of Variable Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-Truncation-of-Variable-Name/m-p/569299#M160416</link>
      <description>Thanks! Sorry for the theoretical approach. It appears that changing the area of where I added length was sufficient in resolving my issue. I will add a 'have' dataset in the future.</description>
      <pubDate>Wed, 26 Jun 2019 21:55:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-Truncation-of-Variable-Name/m-p/569299#M160416</guid>
      <dc:creator>serena13lee</dc:creator>
      <dc:date>2019-06-26T21:55:26Z</dc:date>
    </item>
  </channel>
</rss>

