<?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: How do I avoid truncation when combining datasets? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-truncation-when-combining-datasets/m-p/810559#M319631</link>
    <description>&lt;P&gt;Once the values have been truncated, you won't get them back. Anything that is present in the datasets will show up in the result (up to the newly defined length of 100).&lt;/P&gt;
&lt;P&gt;Caution must be taken with the presence of formats in the incoming datasets. Make sure that no format is assigned to the variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; 
length str $100; 
set a b c; 
format str;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 29 Apr 2022 08:58:14 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-04-29T08:58:14Z</dc:date>
    <item>
      <title>How do I avoid truncation when combining datasets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-truncation-when-combining-datasets/m-p/810556#M319629</link>
      <description>&lt;P&gt;I want to combine a number of datasets and each dataset contains a variable with the name of that dataset for every observations (no missing values).&lt;BR /&gt;No matter what I do the variable gets truncated in the combined dataset.&lt;/P&gt;&lt;P&gt;I have tried increasing the length to 100 in each dataset before joining them.&lt;BR /&gt;I have tried setting length again before the set statement in a data step.&lt;BR /&gt;I have tried joining the tables using outer union corr in proc sql.&lt;/P&gt;&lt;P&gt;Can anyone help me work out why this variable still gets truncated?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example code:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data want;&amp;nbsp;&lt;BR /&gt;length str $100.;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set a b c;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt;create table want as&amp;nbsp;&lt;/P&gt;&lt;P&gt;select * from a&amp;nbsp;&lt;/P&gt;&lt;P&gt;outer union corr&lt;/P&gt;&lt;P&gt;select * from b&amp;nbsp;&lt;/P&gt;&lt;P&gt;outer union corr&amp;nbsp;&lt;/P&gt;&lt;P&gt;select * from c&amp;nbsp;&lt;/P&gt;&lt;P&gt;outer union corr&amp;nbsp;&lt;/P&gt;&lt;P&gt;;quit;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 08:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-truncation-when-combining-datasets/m-p/810556#M319629</guid>
      <dc:creator>HenF</dc:creator>
      <dc:date>2022-04-29T08:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid truncation when combining datasets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-truncation-when-combining-datasets/m-p/810559#M319631</link>
      <description>&lt;P&gt;Once the values have been truncated, you won't get them back. Anything that is present in the datasets will show up in the result (up to the newly defined length of 100).&lt;/P&gt;
&lt;P&gt;Caution must be taken with the presence of formats in the incoming datasets. Make sure that no format is assigned to the variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; 
length str $100; 
set a b c; 
format str;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Apr 2022 08:58:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-truncation-when-combining-datasets/m-p/810559#M319631</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-29T08:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid truncation when combining datasets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-truncation-when-combining-datasets/m-p/810588#M319647</link>
      <description>&lt;P&gt;If you're allowed to modify the original datasets, something like this might work ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a;&amp;nbsp;&lt;BR /&gt;length str $100.;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set a;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data b;&amp;nbsp;&lt;BR /&gt;length str $100.;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set b;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data c;&amp;nbsp;&lt;BR /&gt;length str $100.;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set c;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql ;&lt;/P&gt;
&lt;P&gt;create table want as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select * from a&amp;nbsp;&lt;/P&gt;
&lt;P&gt;outer union corr&lt;/P&gt;
&lt;P&gt;select * from b&amp;nbsp;&lt;/P&gt;
&lt;P&gt;outer union corr&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select * from c&amp;nbsp;&lt;/P&gt;
&lt;P&gt;outer union corr&amp;nbsp;&lt;/P&gt;
&lt;P&gt;;quit;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 11:45:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-truncation-when-combining-datasets/m-p/810588#M319647</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2022-04-29T11:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid truncation when combining datasets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-truncation-when-combining-datasets/m-p/810719#M319723</link>
      <description>&lt;P&gt;The datasets all had sufficient lengths for that variable, the problem was caused by formats.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Removing them solved the problem.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 18:30:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-truncation-when-combining-datasets/m-p/810719#M319723</guid>
      <dc:creator>HenF</dc:creator>
      <dc:date>2022-04-29T18:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I avoid truncation when combining datasets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-truncation-when-combining-datasets/m-p/810720#M319724</link>
      <description>The problem was caused by formats, but thanks!</description>
      <pubDate>Fri, 29 Apr 2022 18:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-avoid-truncation-when-combining-datasets/m-p/810720#M319724</guid>
      <dc:creator>HenF</dc:creator>
      <dc:date>2022-04-29T18:31:17Z</dc:date>
    </item>
  </channel>
</rss>

