<?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 to resolve this warning in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651639#M22409</link>
    <description>&lt;P&gt;Please try something as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
length defaultname $100;
set base data;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 29 May 2020 07:24:23 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2020-05-29T07:24:23Z</dc:date>
    <item>
      <title>how to resolve this warning</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651635#M22407</link>
      <description>&lt;P&gt;I want to append two files but it is throwing a warning:&lt;/P&gt;
&lt;P&gt;WARNING: Variable defaultname has different lengths on BASE and DATA files (BASE 70 DATA 100).&lt;/P&gt;
&lt;P&gt;How it can be resolved&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 07:00:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651635#M22407</guid>
      <dc:creator>annypanny</dc:creator>
      <dc:date>2020-05-29T07:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to resolve this warning</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651636#M22408</link>
      <description>change the `defaultname` variable length in DATA from 100 to 70</description>
      <pubDate>Fri, 29 May 2020 07:15:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651636#M22408</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-05-29T07:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to resolve this warning</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651639#M22409</link>
      <description>&lt;P&gt;Please try something as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
length defaultname $100;
set base data;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 May 2020 07:24:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651639#M22409</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-05-29T07:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to resolve this warning</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651644#M22410</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/316738"&gt;@annypanny&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS put a warning in the log because it "wonders" if the variable "defautlname" refers to the same variable. Indeed, this variable is present in both input datasets and has common caracteristics: same type (otherwise you would have an error in the log) and same name. However, the length differs.&lt;/P&gt;
&lt;P&gt;To avoid this issue, you need to tell SAS what is the appropriate length first. To do that, you can specify it in a&amp;nbsp;LENGTH statement. The PDV containing the variable definition is then correctly set up before filling in the dataset with the original values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 07:35:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651644#M22410</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-29T07:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to resolve this warning</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651653#M22411</link>
      <description>&lt;P&gt;The ideal solution (and the one you should pursue) is to create all common variables with identical attributes in the first place. How you do this depends on the method used to get data into SAS.&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 08:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651653#M22411</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-29T08:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to resolve this warning</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651680#M22412</link>
      <description>&lt;P&gt;First of all: Congrats that you're reading the SAS log. Too many people aren't and I'm right now in a project where I have to clean-up such mess.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Warning indicates that you're appending a column with a length of 70 to a base table with the same named column with a length of 100. Because the length of the column in the Base table is longer nothing bad like actual string truncation will happen.&lt;/P&gt;
&lt;P&gt;Ideally a variable with the same name always means the same and has the same attributes (including the length) throughout your application. So if you really want to tidy up things that's what you should try to achieve and figure out why this is not the case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can "force" the column attributes of your data table to be the same as your base table via a preliminary SAS data step in the form of:&lt;/P&gt;
&lt;PRE&gt;data &amp;lt;data table&amp;gt;;
  if 0 then set &amp;lt;base table&amp;gt;;
  set &amp;lt;data table&amp;gt;;
run;

proc append base=&amp;lt;base table&amp;gt; data=&amp;lt;data table&amp;gt;;
run;

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 10:18:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651680#M22412</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-05-29T10:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to resolve this warning</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651683#M22413</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data &amp;lt;data table&amp;gt;;
  if 0 then set &amp;lt;base table&amp;gt;;
  set &amp;lt;data table&amp;gt;;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;approach will still generate warning, e.g.&lt;/P&gt;
&lt;PRE&gt;1
2    data BASE;
3      length defaultname $ 70;
4      defaultname = "Alice";
5    run;

NOTE: The data set WORK.BASE has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


6
7    data DATA;
8      length defaultname $ 100;
9      defaultname = "Bob";
10   run;

NOTE: The data set WORK.DATA has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


11
12   data DATA;
13     if 0 then set BASE;
14     set DATA;
15   run;

WARNING: Multiple lengths were specified for the variable defaultname by input data set(s). This can cause truncation of
         data.
NOTE: There were 1 observations read from the data set WORK.DATA.
NOTE: The data set WORK.DATA has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
&lt;/PRE&gt;
&lt;P&gt;But this one:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DATA;
  set DATA;
  length _tmp_ $ 70;
  _tmp_ = defaultname;
  drop defaultname;
  rename _tmp_ = defaultname;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;won't:&lt;/P&gt;
&lt;PRE&gt;11
12   data DATA;
13     set DATA;
14     length _tmp_ $ 70;
15     _tmp_ = defaultname;
16     drop defaultname;
17     rename _tmp_ = defaultname;
18   run;

NOTE: There were 1 observations read from the data set WORK.DATA.
NOTE: The data set WORK.DATA has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the best&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 10:48:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651683#M22413</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-05-29T10:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to resolve this warning</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651687#M22414</link>
      <description>Thank you, but above code throws a warning:&lt;BR /&gt;WARNING: Multiple lengths were specified for the variable defaultname by input data set(s). This can cause truncation of data.</description>
      <pubDate>Fri, 29 May 2020 11:04:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651687#M22414</guid>
      <dc:creator>annypanny</dc:creator>
      <dc:date>2020-05-29T11:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to resolve this warning</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651757#M22421</link>
      <description>&lt;P&gt;Please include Log code with any concerns about Warnings, Notes or Error messages.&lt;/P&gt;
&lt;P&gt;Please copy from the log the entire data step or procedure involved and paste into a code box opened on the forum using the &amp;lt;/&amp;gt; icon to preserve formatting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 15:14:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-resolve-this-warning/m-p/651757#M22421</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-29T15:14:35Z</dc:date>
    </item>
  </channel>
</rss>

