<?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: is there a way to initial the variable when append dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-initial-the-variable-when-append-dataset/m-p/8549#M344</link>
    <description>Thank you both very much indeed. &lt;BR /&gt;
&lt;BR /&gt;
I love both suggestions. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;    It solves my problem perfectly. &lt;BR /&gt;
&lt;BR /&gt;
thank you very much again.</description>
    <pubDate>Wed, 29 Sep 2010 15:17:07 GMT</pubDate>
    <dc:creator>kwu</dc:creator>
    <dc:date>2010-09-29T15:17:07Z</dc:date>
    <item>
      <title>is there a way to initial the variable when append dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-initial-the-variable-when-append-dataset/m-p/8546#M341</link>
      <description>I am trying to append dataset ds1 to base. And, base has one extra variable v1 than ds1. If I just call proc append, then all obs appended to base will have a null v1. Here, I need to put a default value for v1 when appending ds1 to base. &lt;BR /&gt;
is there a way to set a default value for v1 while appending the observations in ds1 to base rather than append to base, and then update the base for those null values of v1?</description>
      <pubDate>Tue, 28 Sep 2010 20:51:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-initial-the-variable-when-append-dataset/m-p/8546#M341</guid>
      <dc:creator>kwu</dc:creator>
      <dc:date>2010-09-28T20:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to initial the variable when append dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-initial-the-variable-when-append-dataset/m-p/8547#M342</link>
      <description>Try this....&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data class1;&lt;BR /&gt;
   set sashelp.class(obs=4);&lt;BR /&gt;
   run;&lt;BR /&gt;
data class2;&lt;BR /&gt;
   set sashelp.class(drop=age firstobs=5);&lt;BR /&gt;
   run;&lt;BR /&gt;
data class1;&lt;BR /&gt;
   if 0 then modify class1;&lt;BR /&gt;
   set class2;&lt;BR /&gt;
   retain age -99;&lt;BR /&gt;
   output;&lt;BR /&gt;
   run;&lt;BR /&gt;
Proc print data=class1;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 28 Sep 2010 21:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-initial-the-variable-when-append-dataset/m-p/8547#M342</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-09-28T21:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to initial the variable when append dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-initial-the-variable-when-append-dataset/m-p/8548#M343</link>
      <description>That's typical case where views are useful. This will not slow down your append regardless of the size of the datasets:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data DS1;&lt;BR /&gt;
  set SASHELP.CLASS(drop=WEIGHT);&lt;BR /&gt;
data BASE;&lt;BR /&gt;
  set SASHELP.CLASS;&lt;BR /&gt;
run;&lt;BR /&gt;
&amp;nbsp;&lt;BR /&gt;
&lt;BR /&gt;
data DS1_V/view=DS1_V;&lt;BR /&gt;
  retain WEIGHT 0;&lt;BR /&gt;
  set DS1;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc append base=BASE data=DS1_V;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Hoping that one day the syntax:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc append base=BASE data=DS1 (variable= (WEIGHT length=8 value=0) );&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
will be valid where the variable=() parameters use the same syntax as the attrib statement - plus the value= option - to create or modify variables for the whole datasets on the fly. The suggestion never made it to the ballot or anywhere else however.</description>
      <pubDate>Wed, 29 Sep 2010 01:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-initial-the-variable-when-append-dataset/m-p/8548#M343</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2010-09-29T01:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to initial the variable when append dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-initial-the-variable-when-append-dataset/m-p/8549#M344</link>
      <description>Thank you both very much indeed. &lt;BR /&gt;
&lt;BR /&gt;
I love both suggestions. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;    It solves my problem perfectly. &lt;BR /&gt;
&lt;BR /&gt;
thank you very much again.</description>
      <pubDate>Wed, 29 Sep 2010 15:17:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-initial-the-variable-when-append-dataset/m-p/8549#M344</guid>
      <dc:creator>kwu</dc:creator>
      <dc:date>2010-09-29T15:17:07Z</dc:date>
    </item>
  </channel>
</rss>

