<?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: Insert Into or Append in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230629#M41848</link>
    <description>&lt;P&gt;What have you tried so far?&lt;/P&gt;
&lt;P&gt;Have you been getting error messages? If so, what are they.&lt;/P&gt;</description>
    <pubDate>Mon, 19 Oct 2015 19:10:29 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-10-19T19:10:29Z</dc:date>
    <item>
      <title>Insert Into or Append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230628#M41847</link>
      <description>&lt;P&gt;Newbie can't write an Insert into or an append query to input five records&amp;nbsp; two columns into a two column table. Help.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2015 19:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230628#M41847</guid>
      <dc:creator>BRM_Work</dc:creator>
      <dc:date>2015-10-19T19:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Into or Append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230629#M41848</link>
      <description>&lt;P&gt;What have you tried so far?&lt;/P&gt;
&lt;P&gt;Have you been getting error messages? If so, what are they.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2015 19:10:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230629#M41848</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-10-19T19:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Into or Append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230634#M41849</link>
      <description>&lt;P&gt;Can't seem to get this started I tried insert into and append didn't save the code I am also new to this forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SQL&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CREATE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TABLE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; ShipAlt.PRICINGINFO &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AS&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; * &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;FROM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; WORK.MECH_PRICING&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUTER&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;UNION&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CORR&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; * &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;FROM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; WORK.DLA_PRICING&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;My predecessor wrote the following&amp;nbsp;I would prefer to empty this and append the new dataset and&amp;nbsp;I have a temp dataset of five values I need to append to Princinginfo. I am just a bit lost working with the datatypes. The first column of PrincingInfo is a $Char9 field and the second&amp;nbsp; i believe is an 11.1 I just need to input a currency or a numeric value of whole numbers and a two point decimal.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2015 19:20:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230634#M41849</guid>
      <dc:creator>BRM_Work</dc:creator>
      <dc:date>2015-10-19T19:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Into or Append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230636#M41851</link>
      <description>What do you mean by "empty this"?&lt;BR /&gt;&lt;BR /&gt;Your fields do need to be the same time, so you'll have to convert it somehow. You can convert it in a separate step and then consider using PROC APPEND to append the data. Another option is to change the data type and use a INSERT INTO from PROC SQL. The documentation/sample for a PROC SQL insert into is fairly clear.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/viewer.htm#a001387930.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/viewer.htm#a001387930.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;In your select statement you can do the conversion using a PUT function.&lt;BR /&gt;&lt;BR /&gt;select put(column1, $9.) as column1, column2&lt;BR /&gt;from PRICINGINFO&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Oct 2015 19:24:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230636#M41851</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-10-19T19:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Into or Append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230639#M41854</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;i think i'd like to try something like the following instead of creating a new table each time?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SQL&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DELETE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; * &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;FROM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; ShipAlt.PricingInfo;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SQL&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;INSERT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;INTO&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; ShipAlt.PricingInfo&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;/* with applicable code to input his code created a new table each time didn't it?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SELECT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DISTINCT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; t1.NIIN, &lt;/FONT&gt;t2.STD_PRICE&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;FROM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; SHIPALT.FMPMIS t1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;INNER&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;JOIN&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; CROSSREF.V_ITEMS_MECH t2 &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ON&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; (t1.NIIN = t2.NIIN)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ORDER&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;BY&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; t1.NIIN;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;/* this code created a new table each time and it seems to inheirit the datatypes and lengths from the FMPMIS table I will try to employ your put statement for the string value of nine characters but how to format a whole number and two position decimal in the second column of PrincingInfo?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2015 19:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230639#M41854</guid>
      <dc:creator>BRM_Work</dc:creator>
      <dc:date>2015-10-19T19:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Into or Append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230645#M41858</link>
      <description>&lt;P&gt;Are these tables in SAS or in a database?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's SAS then don't use a Delete as it only deletes the records logically and your table (the actual file) would be growing constantly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With SAS you re-create a table. If you want to maintain the table structure with no&amp;nbsp;rows but all the columns and their attributes then use the following code.&lt;/P&gt;
&lt;PRE&gt;/* option 1 */&lt;BR /&gt;data ShipAlt.PRICINGINFO;&lt;BR /&gt; stop;&lt;BR /&gt; set ShipAlt.PRICINGINFO;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/* option 2 */&lt;BR /&gt;data ShipAlt.PRICINGINFO;&lt;BR /&gt; set ShipAlt.PRICINGINFO (obs=0);&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With tables in a database: Don't use a normal SQL DELETE but a TRUNCATE in pass-through SQL as this is much faster (syntax will depend on the database).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For appending data to a SAS table:&amp;nbsp;Proc Append or the SQL&amp;nbsp;OUTER UNION CORR.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc append base=ShipAlt.PRICINGINFO data=WORK.MECH_PRICING;
run;
proc append base=ShipAlt.PRICINGINFO data=WORK.DLA_PRICING;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2015 21:20:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/230645#M41858</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-10-19T21:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Into or Append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/231967#M42255</link>
      <description>Thanks, hope to hear from you again.</description>
      <pubDate>Wed, 28 Oct 2015 11:58:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-Into-or-Append/m-p/231967#M42255</guid>
      <dc:creator>BRM_Work</dc:creator>
      <dc:date>2015-10-28T11:58:04Z</dc:date>
    </item>
  </channel>
</rss>

