<?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: SAS DI (Data Integration): Inserting a Data in an existing Table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-DI-Data-Integration-Inserting-a-Data-in-an-existing-Table/m-p/178677#M34152</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understand correctly how your source data looks like then you could do something as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* creating source data */&lt;BR /&gt;data raw;&lt;BR /&gt;&amp;nbsp; input branch_cd:$3. rc_name:$20. date:date9.;&lt;BR /&gt;&amp;nbsp; format date date9.;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;01 some_name 01feb2014&lt;BR /&gt;02 some_other_name 01feb2014&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* user written code */&lt;BR /&gt;data uw_prep(drop=_source_date);&lt;BR /&gt;&amp;nbsp; set raw(rename=(date=_source_date));&lt;BR /&gt;&amp;nbsp; format date date9.;&lt;BR /&gt;&amp;nbsp; do&amp;nbsp; date=_source_date to today();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* table loader using append loading UW_PREP into&amp;nbsp; CONSOLIDATED */&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Apr 2014 10:21:43 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2014-04-14T10:21:43Z</dc:date>
    <item>
      <title>SAS DI (Data Integration): Inserting a Data in an existing Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-DI-Data-Integration-Inserting-a-Data-in-an-existing-Table/m-p/178676#M34151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a program in SAS 9.3 (please refer below) that I need to do in SAS Data Integration Studio:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro sqlloop;&lt;/P&gt;&lt;P&gt;Proc SQL;&lt;/P&gt;&lt;P&gt;Select distinct(DATE) into :raw_date from RAW;&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;&lt;P&gt;%DO k= %sysevalf("&amp;amp;raw_date"d) %TO&amp;nbsp; %eval(%sysfunc(today())-1);&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;insert into CONSOLIDATED (BRANCH_CD, RC_NAME, DATE)&lt;/P&gt;&lt;P&gt;select BRANCH_CD, RC_NAME, &amp;amp;k.&lt;/P&gt;&lt;P&gt;from RAW;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;%END;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%sqlloop;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To do this in SAS Data Integration Studio, I did the step and the code inside the "User Written" below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jiveImage" src="https://communities.sas.com/legacyfs/online/5966_pastedImage_0.png" style="width: 636px; height: 80px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let output= &amp;amp;_output;&lt;/P&gt;&lt;P&gt;%let MySYSLast= &amp;amp;SYSLast;&lt;/P&gt;&lt;P&gt;%macro sqlloop;&lt;/P&gt;&lt;P&gt;Proc SQL;&lt;/P&gt;&lt;P&gt;Select distinct(DATE) into :raw_date from &amp;amp;MySYSLast;&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;&lt;P&gt;%DO k= %sysevalf("&amp;amp;raw_date"d) %TO&amp;nbsp; %eval(%sysfunc(today())-1);&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;insert into &amp;amp;output (BRANCH_CD, RC_NAME, DATE)&lt;/P&gt;&lt;P&gt;select BRANCH_CD, RC_NAME, &amp;amp;k.&lt;/P&gt;&lt;P&gt;from &amp;amp;MySYSLast;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;%END;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%sqlloop;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I am receiving an error in running this in SAS DI. May I know how to do this properly in SAS DI? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2014 09:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-DI-Data-Integration-Inserting-a-Data-in-an-existing-Table/m-p/178676#M34151</guid>
      <dc:creator>01SASUser</dc:creator>
      <dc:date>2014-04-14T09:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI (Data Integration): Inserting a Data in an existing Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-DI-Data-Integration-Inserting-a-Data-in-an-existing-Table/m-p/178677#M34152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understand correctly how your source data looks like then you could do something as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* creating source data */&lt;BR /&gt;data raw;&lt;BR /&gt;&amp;nbsp; input branch_cd:$3. rc_name:$20. date:date9.;&lt;BR /&gt;&amp;nbsp; format date date9.;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;01 some_name 01feb2014&lt;BR /&gt;02 some_other_name 01feb2014&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* user written code */&lt;BR /&gt;data uw_prep(drop=_source_date);&lt;BR /&gt;&amp;nbsp; set raw(rename=(date=_source_date));&lt;BR /&gt;&amp;nbsp; format date date9.;&lt;BR /&gt;&amp;nbsp; do&amp;nbsp; date=_source_date to today();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* table loader using append loading UW_PREP into&amp;nbsp; CONSOLIDATED */&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2014 10:21:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-DI-Data-Integration-Inserting-a-Data-in-an-existing-Table/m-p/178677#M34152</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-04-14T10:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI (Data Integration): Inserting a Data in an existing Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-DI-Data-Integration-Inserting-a-Data-in-an-existing-Table/m-p/178678#M34153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Firstly, what is the error message you are receiving.&amp;nbsp; Also, not sure what you are trying to achieve here, maybe some test data and results wanted would help. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2014 10:24:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-DI-Data-Integration-Inserting-a-Data-in-an-existing-Table/m-p/178678#M34153</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-04-14T10:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI (Data Integration): Inserting a Data in an existing Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-DI-Data-Integration-Inserting-a-Data-in-an-existing-Table/m-p/178679#M34154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't follow the logic.&lt;/P&gt;&lt;P&gt;Please describe the underlying requirement - often when you transfer existing applicaitons, you may want to re-engineer the work. Either because there are better ways to solving the problem, and secondly you need to adapt DI Studio way of thinking, to make it manageable over time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2014 10:48:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-DI-Data-Integration-Inserting-a-Data-in-an-existing-Table/m-p/178679#M34154</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-04-14T10:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI (Data Integration): Inserting a Data in an existing Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-DI-Data-Integration-Inserting-a-Data-in-an-existing-Table/m-p/178680#M34155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Apologies for the late response. We had a long weekend.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried your suggested script and it worked! Thank you for your help. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 01:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-DI-Data-Integration-Inserting-a-Data-in-an-existing-Table/m-p/178680#M34155</guid>
      <dc:creator>01SASUser</dc:creator>
      <dc:date>2014-04-22T01:54:42Z</dc:date>
    </item>
  </channel>
</rss>

