<?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: Proc Sql: Creating New Table in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-Creating-New-Table/m-p/457128#M70121</link>
    <description>&lt;P&gt;The green color tells you that SAS considers the name a. or b. as a format name.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Apr 2018 00:13:48 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2018-04-25T00:13:48Z</dc:date>
    <item>
      <title>Proc Sql: Creating New Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-Creating-New-Table/m-p/457121#M70118</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;am trying to&amp;nbsp;get a data set (New) with a new column (col_new) created by little calculation in proc sql. I am using two existing data sets (have1 and have2) and doing the calculation for the observations where year and month of date columns&amp;nbsp;(date1 and date2) are matched.&amp;nbsp;Below is the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
 create table New
   as select a.*, round((a. col1*a. col2)/b. col3, 1) as col_new
    from have1 as a, have2 as b
     where year(a. date1) = year(b. date2) and month(a. date1) = month(b. date2);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This code works well and gives no error. But I want to make sure that is it fine to mention "a" and "b" with dates inside the parenthesis i.e. year (a. date1) or month (b. date2)? Or it should be written as below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where a. year(date1) = b. year(date2) and a. month(date1) = b. month(date2);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please guide me in this regard. Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 23:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-Creating-New-Table/m-p/457121#M70118</guid>
      <dc:creator>Saba1</dc:creator>
      <dc:date>2018-04-24T23:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql: Creating New Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-Creating-New-Table/m-p/457124#M70119</link>
      <description>&lt;P&gt;The correct way to use the date functions such as YEAR or MONTH is almost&amp;nbsp;as you have it in the first bit of code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;where year(a.date1) = year(b.date2) and month(a.date1) = month(b.date2);&lt;/PRE&gt;
&lt;P&gt;HOWEVER you cannot have spaces between the alias (a. b. references) and the variable name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 23:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-Creating-New-Table/m-p/457124#M70119</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-24T23:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql: Creating New Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-Creating-New-Table/m-p/457127#M70120</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;That is great. Thank you so much for the guidance. As far as the space b/w a. b. references and variable names is concerned, I guess this has to do something with my SAS program settings because these references change color (i.e. turn green) only when I give a space, otherwise their font color remains unchanged (i.e. black). Anyhow, I will still give it a try without any space.&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 00:20:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-Creating-New-Table/m-p/457127#M70120</guid>
      <dc:creator>Saba1</dc:creator>
      <dc:date>2018-04-25T00:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql: Creating New Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-Creating-New-Table/m-p/457128#M70121</link>
      <description>&lt;P&gt;The green color tells you that SAS considers the name a. or b. as a format name.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 00:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-Creating-New-Table/m-p/457128#M70121</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-04-25T00:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql: Creating New Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-Creating-New-Table/m-p/457129#M70122</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;Right. But for me these a. and b. turn green only when I give a space between them and variable name (the way i have shown in the code above). Is it ok?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 00:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-Creating-New-Table/m-p/457129#M70122</guid>
      <dc:creator>Saba1</dc:creator>
      <dc:date>2018-04-25T00:21:05Z</dc:date>
    </item>
  </channel>
</rss>

