<?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 How to increase the length of character value in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740328#M29041</link>
    <description>&lt;P&gt;I am combining two dataset and some of the subjs email address "in the observation"&amp;nbsp; is cutting off when I combine the data. I increased the length but, its not helping at all. the email are all fine before combining the data but, when I combine they are cutting of.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of the code I used.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data need&lt;/P&gt;
&lt;P&gt;length email $50;&lt;/P&gt;
&lt;P&gt;set data1 and data2;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 May 2021 23:42:58 GMT</pubDate>
    <dc:creator>hjjijkkl</dc:creator>
    <dc:date>2021-05-10T23:42:58Z</dc:date>
    <item>
      <title>How to increase the length of character value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740328#M29041</link>
      <description>&lt;P&gt;I am combining two dataset and some of the subjs email address "in the observation"&amp;nbsp; is cutting off when I combine the data. I increased the length but, its not helping at all. the email are all fine before combining the data but, when I combine they are cutting of.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of the code I used.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data need&lt;/P&gt;
&lt;P&gt;length email $50;&lt;/P&gt;
&lt;P&gt;set data1 and data2;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 23:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740328#M29041</guid>
      <dc:creator>hjjijkkl</dc:creator>
      <dc:date>2021-05-10T23:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase the length of character value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740329#M29042</link>
      <description>How can I fi this issue</description>
      <pubDate>Mon, 10 May 2021 23:43:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740329#M29042</guid>
      <dc:creator>hjjijkkl</dc:creator>
      <dc:date>2021-05-10T23:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase the length of character value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740331#M29043</link>
      <description>&lt;P&gt;That is a way to set the length of a variable (once you fix the typos). Whether it increases the length or not depends on how it was defined before in DATA1.&amp;nbsp; 50 bytes does not seem long enough for an email address.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note that if it is already truncated in either DATA1 or DATA2 you cannot recover the lost value by just making the variable long.&lt;/STRONG&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you also need to watch out if either DATA1 or DATA2 has a format attached to the variable it might be truncating the printing of the values.&amp;nbsp; There is no good reason to have a $ format attached to a character variable so remove it just in case.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data need ;
  length email $200;
  set data1 data2;
  format email ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 May 2021 00:16:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740331#M29043</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-11T00:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase the length of character value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740341#M29047</link>
      <description>Your code is wrong as shown, assuming you remove the AND it should likely work fine. Make sure 50 is enough and verify that it wasn't truncated before hand as well.</description>
      <pubDate>Tue, 11 May 2021 01:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740341#M29047</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-05-11T01:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase the length of character value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740348#M29049</link>
      <description>&lt;P&gt;If the issue is really that you've got a same named character variable in your two source tables but the lengths of the variable differ then one way to go in case both data sets have the exactly same variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table need as
  select * from data1
  union corr all
  select * from data2
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A SQL UNION CORR ALL will use the max. variable lengths from the source tables to create target table need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you know exactly in which one of the source tables the variable has a greater length then use this source table first in your set statement. SAS creates the variables in the pdv using the first occurrence of the variable in the code. So if your variable has a greater length in data2 then your code could look like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data need
  set data2 data1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or then as you've done in your code set the length of the variable prior to the set statements. That works the same as above as this way the SAS compiler will encounter the variable the first time in the length statement and use this definition to create the variable in the pdv.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data need
  length email $50;
  set data1 data2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 02:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740348#M29049</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-05-11T02:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase the length of character value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740443#M29061</link>
      <description>&lt;P&gt;Try SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 set sashelp.class;
run;


proc sql;
alter table have
modify sex char(20),name char(100);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 May 2021 12:30:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-increase-the-length-of-character-value/m-p/740443#M29061</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-05-11T12:30:51Z</dc:date>
    </item>
  </channel>
</rss>

