<?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 ability to add record in existing record table? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-ability-to-add-record-in-existing-record-table/m-p/129628#M26448</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt; set orig;&lt;/P&gt;&lt;P&gt; if time_to_add = 1 then output new;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data combined;&lt;/P&gt;&lt;P&gt; set orig new;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 May 2012 14:53:15 GMT</pubDate>
    <dc:creator>richard_a</dc:creator>
    <dc:date>2012-05-31T14:53:15Z</dc:date>
    <item>
      <title>SAS ability to add record in existing record table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-ability-to-add-record-in-existing-record-table/m-p/129625#M26445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm relatively new to SAS but just wondering if SAS has the ability to add record. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an Excel table contain lines of records. Because we need to make information complete, for each record in an Excel table, I need to add one additional line based on few logics. (I can do this manually, but it takes long to complete) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that an Excel macro can help me do the job if my logics are correctly built in, but in a general sense, does SAS have the ability to add record into existing record table? Not sure if I'm asking the right people. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 20:01:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-ability-to-add-record-in-existing-record-table/m-p/129625#M26445</guid>
      <dc:creator>SeekYourWay</dc:creator>
      <dc:date>2012-05-30T20:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS ability to add record in existing record table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-ability-to-add-record-in-existing-record-table/m-p/129626#M26446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, SAS can append records to an Excel dataset. There are at least two methods. Try the following (after adjusting the file path to your environment) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname xl excel "&amp;amp;sasForum.\datasets\addRecord.xlsx" scan_text=no;&lt;BR /&gt; &lt;BR /&gt;data xl.one;&lt;BR /&gt;do x = 1 to 10;&lt;BR /&gt; output;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data two;&lt;BR /&gt;do x = 11 to 20;&lt;BR /&gt; output;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc append base=xl.one data=two; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data three;&lt;BR /&gt;do x = 21 to 30;&lt;BR /&gt; output;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;insert into xl.one select * from three;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname xl clear;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 21:46:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-ability-to-add-record-in-existing-record-table/m-p/129626#M26446</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-05-30T21:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS ability to add record in existing record table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-ability-to-add-record-in-existing-record-table/m-p/129627#M26447</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;Thanks for your response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have a moment to spare, my problem is described in the attached file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This table is the initial record table into which one additional record needs to be added.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 799px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="70"&gt;Record_ID&lt;/TD&gt;&lt;TD class="xl65" width="119"&gt;Assessment_Type&lt;/TD&gt;&lt;TD class="xl65" width="119"&gt;admission_date&lt;/TD&gt;&lt;TD class="xl65" width="119"&gt;Start_Date&lt;/TD&gt;&lt;TD class="xl65" width="119"&gt;End_Date&lt;/TD&gt;&lt;TD class="xl65" width="157"&gt;Break_down_Necessary&lt;/TD&gt;&lt;TD class="xl65" width="96"&gt;days_Counted&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20"&gt;2&lt;/TD&gt;&lt;TD class="xl65"&gt;3&lt;/TD&gt;&lt;TD class="xl66"&gt;4/11/2010&lt;/TD&gt;&lt;TD class="xl66"&gt;4/14/2010&lt;/TD&gt;&lt;TD class="xl66"&gt;4/16/2010&lt;/TD&gt;&lt;TD class="xl65"&gt;n&lt;/TD&gt;&lt;TD class="xl65"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20"&gt;2&lt;/TD&gt;&lt;TD class="xl65"&gt;4&lt;/TD&gt;&lt;TD class="xl66"&gt;4/11/2010&lt;/TD&gt;&lt;TD class="xl66"&gt;4/16/2010&lt;/TD&gt;&lt;TD class="xl66"&gt;6/15/2010&lt;/TD&gt;&lt;TD class="xl65"&gt;y&lt;/TD&gt;&lt;TD class="xl65"&gt;60&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the following table shows the added record&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 799px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="70"&gt;Record_ID&lt;/TD&gt;&lt;TD class="xl65" width="119"&gt;Assessment_Type&lt;/TD&gt;&lt;TD class="xl65" width="119"&gt;admission_Date&lt;/TD&gt;&lt;TD class="xl65" width="119"&gt;Start_Date&lt;/TD&gt;&lt;TD class="xl65" width="119"&gt;End_Date&lt;/TD&gt;&lt;TD class="xl65" width="157"&gt;Break_down_Necessary&lt;/TD&gt;&lt;TD class="xl65" width="96"&gt;days_Counted&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20"&gt;2&lt;/TD&gt;&lt;TD class="xl65"&gt;3&lt;/TD&gt;&lt;TD class="xl66"&gt;4/11/2010&lt;/TD&gt;&lt;TD class="xl66"&gt;4/14/2010&lt;/TD&gt;&lt;TD class="xl66"&gt;4/16/2010&lt;/TD&gt;&lt;TD class="xl65"&gt;n&lt;/TD&gt;&lt;TD class="xl65"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="20"&gt;&lt;SPAN style="color: #993366;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;SPAN style="color: #993366;"&gt;added&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl67"&gt;&lt;SPAN style="color: #993366;"&gt;4/11/2010&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl67"&gt;&lt;SPAN style="color: #993366;"&gt;4/16/2010&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl67"&gt;&lt;SPAN style="color: #993366;"&gt;6/15/2010&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;SPAN style="color: #993366;"&gt;added&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;SPAN style="color: #993366;"&gt;60&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20"&gt;2&lt;/TD&gt;&lt;TD class="xl65"&gt;4&lt;/TD&gt;&lt;TD class="xl66"&gt;4/11/2010&lt;/TD&gt;&lt;TD class="xl66"&gt;6/15/2010&lt;/TD&gt;&lt;TD class="xl66"&gt;6/15/2010&lt;/TD&gt;&lt;TD class="xl65"&gt;n&lt;/TD&gt;&lt;TD class="xl65"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the logic is....whenever the break down necessary column shows a y, then we need to add a row ABOVE. The first row in the 2nd table remains the same. On the added line as you can see, the start_date becomes the end_date of the previous line, and its end_date is whenever the original end_date was. On the 3rd line, the start_date and end_date is the same&amp;nbsp; in this case. All three lines will have the same admission_date assigned. We get 60 for the days_counted because it's just the subtraction of start_date from end_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know it may seem redundant the way that record needs to be inserted, but it will satisfy our reporting standard.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone able to assist? Can this be done in SAS platform?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2012 13:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-ability-to-add-record-in-existing-record-table/m-p/129627#M26447</guid>
      <dc:creator>SeekYourWay</dc:creator>
      <dc:date>2012-05-31T13:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS ability to add record in existing record table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-ability-to-add-record-in-existing-record-table/m-p/129628#M26448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt; set orig;&lt;/P&gt;&lt;P&gt; if time_to_add = 1 then output new;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data combined;&lt;/P&gt;&lt;P&gt; set orig new;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2012 14:53:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-ability-to-add-record-in-existing-record-table/m-p/129628#M26448</guid>
      <dc:creator>richard_a</dc:creator>
      <dc:date>2012-05-31T14:53:15Z</dc:date>
    </item>
  </channel>
</rss>

