<?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: WARNING: Multiple lengths were specified in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322390#M71326</link>
    <description>&lt;P&gt;To answer your original question, why do you get 4 observations ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As the DATA step begins, NAME is missing.&amp;nbsp; Therefore, the first SET statement is skipped, and the second one executes.&amp;nbsp; It reads the first observation from NEW (changing NAME to "RET_AKT") which becomes the first observation in NEW1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From that point forward, NAME is always "RET_AKT".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Therefore, for the rest of the DATA step, the first SET statement executes.&amp;nbsp; Each SET statement is independent of the other, so the first SET statement begins at the start of NEW and (one at a time) reads in three observations.&amp;nbsp; Those become the 2nd through 4th observations in NEW1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would be easier for you to see this if you were to add another variable.&amp;nbsp; For example, in the creation of NEW, add:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;obsno = _n_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you could look at OBSNO to see where the observations in NEW1 are coming from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jan 2017 13:53:46 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-01-04T13:53:46Z</dc:date>
    <item>
      <title>WARNING: Multiple lengths were specified</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322345#M71311</link>
      <description>&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;data new;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;input name $;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;datalines;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;RET_AKT&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;RET_HIS&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;RET_AKT&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;RET_AKT&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;AMU_NEW&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;AMU_OLD&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;data new1;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;if name='RET_AKT' then do;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;set new;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;where name='RET_AKT';&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;else if name='' then do;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;set new;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;WARNING: Multiple lengths were specified for the variable name by input data set(s). This may&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cause truncation of data.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: There were 3 observations read from the data set WORK.NEW.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE name='RET_AKT';&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: There were 1 observations read from the data set WORK.NEW.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: The data set WORK.NEW1 has 4 observations and 1 variables.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;NOTE: DATA statement used (Total process time):&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;Question . why it is showing 4 obeservation in output dataset &amp;nbsp;new1 &amp;nbsp;not 3 observation. I want 3 observation in the &amp;nbsp;dataset new1.why warning is coming&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 07:57:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322345#M71311</guid>
      <dc:creator>Rohit12</dc:creator>
      <dc:date>2017-01-04T07:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: BASE SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322348#M71314</link>
      <description>&lt;P&gt;What are you trying to achieve?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 07:56:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322348#M71314</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-01-04T07:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: BASE SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322356#M71317</link>
      <description>&lt;P&gt;I will create a macro variable which will have column 'name' value or it will be blank&lt;/P&gt;&lt;P&gt;for ex&lt;BR /&gt;let x =RET_AKT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After that I want to create a dataset which will take this macro variable value and compare this macro variable value with the column 'name' if value is equal then it will create the dataset 'NEW1' with where name=&amp;amp;x and if value of macro variable is blank then it will copy all the records from dataset 'new' to dataset 'new1'&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;for ex&lt;/P&gt;&lt;P&gt;if let x=RET_AKT; then it will copy 3 records from dataset new to dataset new1&lt;/P&gt;&lt;P&gt;and if let x=; then it should copy 6 records to dataset new 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope I able to explain&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 09:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322356#M71317</guid>
      <dc:creator>Rohit12</dc:creator>
      <dc:date>2017-01-04T09:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Multiple lengths were specified</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322360#M71318</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If i understood the question correctly, you want to filter out the data based on the name value of- 'RET_AKT'.&lt;/P&gt;
&lt;P&gt;You are doing the logic incorrectly,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data new;
input name $;
datalines;
RET_AKT
RET_HIS
RET_AKT
RET_AKT
AMU_NEW
AMU_OLD
;
run;
 
 
data new1;
set new;
where name='RET_AKT';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the warning is coming, because when you created the dataset new, the default length of 8 byte is assigned . However when you created the datset new1, you didn't assign the length, so it took the length from the first assignement of name variable, ie. from&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;if name='RET_AKT' &lt;/STRONG&gt;&lt;/U&gt;then do; which will only have a length of 7 bytes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;WARNING: Multiple lengths were specified for the variable name by input data set(s). This may&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cause truncation of data.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;Hoep this helps!&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;Manjeet&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 09:56:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322360#M71318</guid>
      <dc:creator>mnjtrana</dc:creator>
      <dc:date>2017-01-04T09:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: BASE SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322363#M71320</link>
      <description>data new;&lt;BR /&gt;input name $;&lt;BR /&gt;datalines;&lt;BR /&gt;RET_AKT&lt;BR /&gt;RET_HIS&lt;BR /&gt;RET_AKT&lt;BR /&gt;RET_AKT&lt;BR /&gt;AMU_NEW&lt;BR /&gt;AMU_OLD&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;%let x=RET_AKT;&lt;BR /&gt;&lt;BR /&gt;data new1;&lt;BR /&gt;if name="&amp;amp;X" then do;&lt;BR /&gt;set new;&lt;BR /&gt;where name="&amp;amp;X";&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;else if name='' then do;&lt;BR /&gt;set new;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;why it is showing 4 rows in the output</description>
      <pubDate>Wed, 04 Jan 2017 10:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322363#M71320</guid>
      <dc:creator>Rohit12</dc:creator>
      <dc:date>2017-01-04T10:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Multiple lengths were specified</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322368#M71324</link>
      <description>&lt;P&gt;Small correction to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/34466"&gt;@mnjtrana&lt;/a&gt;&amp;nbsp;solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;%let X=RET_AKT;&lt;BR /&gt;&lt;BR /&gt;data&lt;/SPAN&gt; new1&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; new&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; NAME&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"&amp;amp;X" or "&amp;amp;X" = ''&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, &amp;nbsp;if NAME=X then dataset is filtered else X='' then all obs are kept.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 11:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322368#M71324</guid>
      <dc:creator>Daniel-Santos</dc:creator>
      <dc:date>2017-01-04T11:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Multiple lengths were specified</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322390#M71326</link>
      <description>&lt;P&gt;To answer your original question, why do you get 4 observations ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As the DATA step begins, NAME is missing.&amp;nbsp; Therefore, the first SET statement is skipped, and the second one executes.&amp;nbsp; It reads the first observation from NEW (changing NAME to "RET_AKT") which becomes the first observation in NEW1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From that point forward, NAME is always "RET_AKT".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Therefore, for the rest of the DATA step, the first SET statement executes.&amp;nbsp; Each SET statement is independent of the other, so the first SET statement begins at the start of NEW and (one at a time) reads in three observations.&amp;nbsp; Those become the 2nd through 4th observations in NEW1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would be easier for you to see this if you were to add another variable.&amp;nbsp; For example, in the creation of NEW, add:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;obsno = _n_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you could look at OBSNO to see where the observations in NEW1 are coming from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 13:53:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Multiple-lengths-were-specified/m-p/322390#M71326</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-01-04T13:53:46Z</dc:date>
    </item>
  </channel>
</rss>

