<?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: Create &amp;amp; insert into table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-amp-insert-into-table/m-p/706569#M216870</link>
    <description>&lt;P&gt;You either must do a CREATE TABLE or a INSERT INTO statement.&lt;/P&gt;
&lt;P&gt;As a part of a SELECT clause, INTO is used to store values into macro variables (that's why it expected a colon there, followed by the macro variable name).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is sufficient to create your new table in WORK:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql outobs = 2;
create table work.checking as
  select
    e.employeekey
    ,e.Name as First_Name "First Name"
    ,e.Surname
    ,o.Division
    ,o.Segment
    ,o.Businessunit as Business_Unit "Business Unit"
  from BI_CWH.Factcurrentemployeecount f
  join BI_CWH.Dimemployee e on e.dimemployeeid = f.dimemployeeid
  join BI_CWH.DimOrganisationManagement o on o.DimOrganisationManagementID = f.DimOrganisationManagementID
  where
    f.MonthKey = (select Value from BI_CWH.Control where DataFlow = "Oracle HRMS")
    and f.HeadCount = 1
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 17 Dec 2020 08:59:25 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-12-17T08:59:25Z</dc:date>
    <item>
      <title>Create &amp; insert into table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-amp-insert-into-table/m-p/706564#M216868</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am trying to create a table and insert data into it in a Proc SQL.&lt;/P&gt;&lt;P&gt;The problem is that the fields are unknown until the query has run.&lt;/P&gt;&lt;P&gt;Sql uses "into BI_Dbrd.SAS_BIDP037_Supervisor_Rpt" and then creates the new table with the fields loaded.&lt;/P&gt;&lt;P&gt;I can only find "insert into BI_Dbrd.SAS_BIDP037_Supervisor_Rpt " but the table must exist already&lt;/P&gt;&lt;P&gt;This is my code&lt;/P&gt;&lt;P&gt;Proc SQL outobs = 2;&lt;BR /&gt;/*insert into BI_Dbrd.SAS_BIDP037_Supervisor_Rpt */&lt;BR /&gt;Create table work.checking as&lt;BR /&gt;select e.employeekey&lt;BR /&gt;,e.Name as First_Name "First Name"&lt;BR /&gt;,e.Surname&lt;BR /&gt;,o.Division&lt;BR /&gt;,o.Segment&lt;BR /&gt;,o.Businessunit as Business_Unit "Business Unit"&lt;BR /&gt;into BI_Dbrd.dbo.SAS_BIDP037_Supervisor_Rpt&lt;BR /&gt;From BI_CWH.Factcurrentemployeecount f&lt;BR /&gt;join BI_CWH.Dimemployee e on e.dimemployeeid = f.dimemployeeid&lt;BR /&gt;join BI_CWH.DimOrganisationManagement o on o.DimOrganisationManagementID = f.DimOrganisationManagementID&lt;/P&gt;&lt;P&gt;Where f.MonthKey = (Select Value from BI_CWH.Control Where DataFlow = "Oracle HRMS")&lt;BR /&gt;and f.HeadCount = 1;&lt;BR /&gt;Quit;&lt;/P&gt;&lt;P&gt;The error I get is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ColleenCB_0-1608194128405.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/52730i87D541C57FC18F10/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ColleenCB_0-1608194128405.png" alt="ColleenCB_0-1608194128405.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can someone please assist?&lt;/P&gt;&lt;P&gt;Have a lovely day&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2020 08:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-amp-insert-into-table/m-p/706564#M216868</guid>
      <dc:creator>ColleenCB</dc:creator>
      <dc:date>2020-12-17T08:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create &amp; insert into table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-amp-insert-into-table/m-p/706569#M216870</link>
      <description>&lt;P&gt;You either must do a CREATE TABLE or a INSERT INTO statement.&lt;/P&gt;
&lt;P&gt;As a part of a SELECT clause, INTO is used to store values into macro variables (that's why it expected a colon there, followed by the macro variable name).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is sufficient to create your new table in WORK:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql outobs = 2;
create table work.checking as
  select
    e.employeekey
    ,e.Name as First_Name "First Name"
    ,e.Surname
    ,o.Division
    ,o.Segment
    ,o.Businessunit as Business_Unit "Business Unit"
  from BI_CWH.Factcurrentemployeecount f
  join BI_CWH.Dimemployee e on e.dimemployeeid = f.dimemployeeid
  join BI_CWH.DimOrganisationManagement o on o.DimOrganisationManagementID = f.DimOrganisationManagementID
  where
    f.MonthKey = (select Value from BI_CWH.Control where DataFlow = "Oracle HRMS")
    and f.HeadCount = 1
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Dec 2020 08:59:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-amp-insert-into-table/m-p/706569#M216870</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-17T08:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create &amp; insert into table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-amp-insert-into-table/m-p/706578#M216875</link>
      <description>Thank you.&lt;BR /&gt;I had to change "work." to our server, and the name was also longer than 30 characters.&lt;BR /&gt;The name I can change in Sql.&lt;BR /&gt;This saves a lot of time.</description>
      <pubDate>Thu, 17 Dec 2020 10:02:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-amp-insert-into-table/m-p/706578#M216875</guid>
      <dc:creator>ColleenCB</dc:creator>
      <dc:date>2020-12-17T10:02:00Z</dc:date>
    </item>
  </channel>
</rss>

