<?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: Why won't character resizing work? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-won-t-character-resizing-work/m-p/374487#M89678</link>
    <description>&lt;P&gt;You need to show exactly what you did as SAS will set the length for the variable at the first point it can.&lt;/P&gt;
&lt;P&gt;So if the LENGTH statement comes after a SET statement for a dataset that already has that variable the LENGTH statement is ignored.&lt;/P&gt;
&lt;P&gt;Also watch out for FORMATs that might be attached to character variables. &amp;nbsp;It is best to just remove any formats that might have gotten accidentally attached to character variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example for how to create a new dataset with changed variable lengths.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  length Variable $27 Variables_in_model $800; 
  set have ;
  format variable variables_in_model ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 10 Jul 2017 13:16:19 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2017-07-10T13:16:19Z</dc:date>
    <item>
      <title>Why won't character resizing work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-won-t-character-resizing-work/m-p/374478#M89674</link>
      <description>&lt;P&gt;I have a data set that summarizes several hundred candidate models and one field is "Vars_in_model" and another is "Variable."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Upon declaration, I do data out Data; length Variable $27; length Variables_in_model $800; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That works, but when the data set is updated with the component macros, somehow the "Variable" gets set to size 16 and variables_in_model get set to $57. It is clearly setting it to the shortest. I have unchecked the options in SAS Eg, and re checked and re run and get the same result.&lt;BR /&gt;&lt;BR /&gt;What is odd to me is I even take the output data set and try to resize with the same statements and it still stays the same size. I am doing a work around where I start with the largest first so it gets set with the largest, but this seems odd to me. Any suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 12:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-won-t-character-resizing-work/m-p/374478#M89674</guid>
      <dc:creator>stratozyck</dc:creator>
      <dc:date>2017-07-10T12:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why won't character resizing work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-won-t-character-resizing-work/m-p/374486#M89677</link>
      <description>&lt;P&gt;When you use more than one dataset in a set statement, and the datasets contain common variables, the attributes are set from the first dataset named in the set that contains a given variable. If subsequent datasets contain the same variable with a bigger length, the values from that are truncated, and you get a WARNING about that in the log.&lt;/P&gt;
&lt;P&gt;Make sure that a certain variable is always created with the same length in all your datasets. This gives you a clean log and avoids confusion.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 13:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-won-t-character-resizing-work/m-p/374486#M89677</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-10T13:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Why won't character resizing work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-won-t-character-resizing-work/m-p/374487#M89678</link>
      <description>&lt;P&gt;You need to show exactly what you did as SAS will set the length for the variable at the first point it can.&lt;/P&gt;
&lt;P&gt;So if the LENGTH statement comes after a SET statement for a dataset that already has that variable the LENGTH statement is ignored.&lt;/P&gt;
&lt;P&gt;Also watch out for FORMATs that might be attached to character variables. &amp;nbsp;It is best to just remove any formats that might have gotten accidentally attached to character variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example for how to create a new dataset with changed variable lengths.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  length Variable $27 Variables_in_model $800; 
  set have ;
  format variable variables_in_model ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Jul 2017 13:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-won-t-character-resizing-work/m-p/374487#M89678</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-10T13:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why won't character resizing work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-won-t-character-resizing-work/m-p/374498#M89684</link>
      <description>&lt;P&gt;It is fixed by changing the order of the multiple sets. I don't know why that works because both data sets had the same formatting.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 13:54:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-won-t-character-resizing-work/m-p/374498#M89684</guid>
      <dc:creator>stratozyck</dc:creator>
      <dc:date>2017-07-10T13:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why won't character resizing work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-won-t-character-resizing-work/m-p/374499#M89685</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/150508"&gt;@stratozyck&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;It is fixed by changing the order of the multiple sets. I don't know why that works because both data sets had the same formatting.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;By definition the datasets did not have the same structure if changing the order of the datasets in a SET statement made a difference.&lt;/P&gt;
&lt;P&gt;Note that you cannot count on being able to fix this type of issue by just changing the dataset order. What if there is&amp;nbsp;more than one variable with different lengths? &amp;nbsp;You could have a situation where any order results in one of the variables being truncated.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 14:00:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-won-t-character-resizing-work/m-p/374499#M89685</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-10T14:00:59Z</dc:date>
    </item>
  </channel>
</rss>

