<?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: PROC Append - different lengths on BASE and DATA files in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/742923#M80575</link>
    <description>&lt;P&gt;Make the data structures match.&lt;/P&gt;
&lt;P&gt;Why are they different now?&amp;nbsp; How did you create the original (BASE) dataset?&amp;nbsp; How did you create the new (DATA) dataset?&lt;/P&gt;</description>
    <pubDate>Fri, 21 May 2021 15:24:37 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-05-21T15:24:37Z</dc:date>
    <item>
      <title>PROC Append - different lengths on BASE and DATA files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/742910#M80574</link>
      <description>&lt;P&gt;581 options varlenchk=nowarn;&lt;BR /&gt;582 proc append base=varImphsp data=work.bs_varImphsp force nowarn;&lt;BR /&gt;583 run;&lt;BR /&gt;WARNING: Variable variable has different lengths on BASE and DATA files (BASE 32 DATA 3).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to remove the warning?&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 14:46:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/742910#M80574</guid>
      <dc:creator>su35</dc:creator>
      <dc:date>2021-05-21T14:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Append - different lengths on BASE and DATA files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/742923#M80575</link>
      <description>&lt;P&gt;Make the data structures match.&lt;/P&gt;
&lt;P&gt;Why are they different now?&amp;nbsp; How did you create the original (BASE) dataset?&amp;nbsp; How did you create the new (DATA) dataset?&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 15:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/742923#M80575</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-21T15:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Append - different lengths on BASE and DATA files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743127#M80576</link>
      <description>Thanks Tom.&lt;BR /&gt;The code is a section of a macro loop. The BASE is the final result dataset, the DATA is one ODS output of proc hpsplit of each iteration.&lt;BR /&gt;Now, the only solution for me is adding a data step or SQL to modify the variable length of the DATA dataset.&lt;BR /&gt;I want to know if there is a more simple and direct solution.</description>
      <pubDate>Sat, 22 May 2021 13:41:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743127#M80576</guid>
      <dc:creator>su35</dc:creator>
      <dc:date>2021-05-22T13:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Append - different lengths on BASE and DATA files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743129#M80577</link>
      <description>&lt;P&gt;That is one of the problems with using ODS OUTPUT to generate datasets.&amp;nbsp; &amp;nbsp;The structure is not consistent as it depends on the values that the procedure wants to DISPLAY for this analysis.&lt;/P&gt;
&lt;P&gt;If you switch to using actual OUT= datasets (if available in the PROC(s) you are using) then the structure will be more consistent.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will want to define a structure and use that.&amp;nbsp; Probably best to define it before the first iteration of the loop.&lt;/P&gt;
&lt;P&gt;That might be enough.&amp;nbsp; Just make sure to define the character variables long enough for all possible values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data base ;
  length .....
  stop;
run;

%do .....

ods output mystat = next ;
...
proc append base=base data=next force;
run;

%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 May 2021 14:08:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743129#M80577</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-22T14:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Append - different lengths on BASE and DATA files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743154#M80581</link>
      <description>&lt;P&gt;Hi Tom,&lt;BR /&gt;This is exactly my current solution. The proc append would issue the WARNING.&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data base;
    length .....;
    set first_data;
run;
.......
/*except the first data*/
proc append base=base data=data force;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The purpose of using the proc append is about efficiency. But now, I think that there is unnecessary to think about the efficiency since the ODS output datasets are small. So, instead of proc append, I will use the data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data base_set;
    set base_set data_set;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 May 2021 18:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743154#M80581</guid>
      <dc:creator>su35</dc:creator>
      <dc:date>2021-05-22T18:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Append - different lengths on BASE and DATA files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743156#M80583</link>
      <description>&lt;P&gt;Add the NOWARN option to suppress the warnings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc append base=base data=next force nowarn ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 May 2021 19:22:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743156#M80583</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-22T19:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Append - different lengths on BASE and DATA files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743170#M80588</link>
      <description>as the original post showed, the nowarn option doesn't work.</description>
      <pubDate>Sat, 22 May 2021 20:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743170#M80588</guid>
      <dc:creator>su35</dc:creator>
      <dc:date>2021-05-22T20:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Append - different lengths on BASE and DATA files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743187#M80589</link>
      <description>&lt;P&gt;So use a DATA step to make the structures consistent.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data base;
  length name $20 ;
  stop;
run;

data new;
  input name :$10. ;
cards;
Joe
Sam
;

data new2;
  set base(obs=0) new;
run;

proc append base=base data=new2  ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The data step could be a view.&lt;/P&gt;
&lt;P&gt;The data step will still generate a warning if the new dataset defines the variables as LONGER than the target dataset.&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 02:27:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Append-different-lengths-on-BASE-and-DATA-files/m-p/743187#M80589</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-23T02:27:42Z</dc:date>
    </item>
  </channel>
</rss>

