<?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: macro in proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-in-proc-sql/m-p/442621#M282768</link>
    <description>&lt;P&gt;if the purpose of the second select statement is to restrict the data then it is 1) out of order and 2) likely needs parentheses:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you are missing a semicolon between two separate queries&lt;/P&gt;
&lt;PRE&gt;proc sql ;
create table &amp;amp;visit.2 as 
select count (distinct internal_visit_id) AS counttime, 1360 AS TIME_POINT_CONTRACTED
from &amp;amp;visit.1
where Earliest_Visit_Date ne . &lt;FONT color="#ff0000"&gt;;&lt;/FONT&gt;

select counttime , TIME_POINT_CONTRACTED into :counttimet, :timecont from  &amp;amp;visit.2;    
quit; &lt;/PRE&gt;</description>
    <pubDate>Mon, 05 Mar 2018 20:47:50 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-05T20:47:50Z</dc:date>
    <item>
      <title>macro in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-in-proc-sql/m-p/442616#M282766</link>
      <description>&lt;P&gt;I'm trying to create macros in sql and I'm also trying to create a table and that my code and the error that I got&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sql ;&lt;BR /&gt;create table &amp;amp;visit.2 as &lt;BR /&gt;select count (distinct internal_visit_id) AS counttime, 1360 AS TIME_POINT_CONTRACTED&lt;BR /&gt;from &amp;amp;visit.1&lt;BR /&gt;where Earliest_Visit_Date ne .&lt;BR /&gt;select counttime , TIME_POINT_CONTRACTED into :counttimet, :timecont from  &amp;amp;visit.2;    &lt;BR /&gt;quit; &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasSource"&gt;71 proc sql ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72 create table &amp;amp;visit.2 as&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 select count (distinct internal_visit_id) AS counttime, 1360 AS TIME_POINT_CONTRACTED&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 from &amp;amp;visit.1&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 where Earliest_Visit_Date ne .&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 select counttime into :counttimet from &amp;amp;visit.2;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;______&lt;/DIV&gt;&lt;DIV class="sasError"&gt;22&lt;/DIV&gt;&lt;DIV class="sasError"&gt;76&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 22-322: Syntax error, expecting one of the following: &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, EQ, EQT, EXCEPT, GE, GET, GT, GTT, INTERSECT, LE,&lt;/DIV&gt;&lt;DIV class="sasError"&gt;LET, LT, LTT, NE, NET, UNION, ^=, ~=.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/DIV&gt;</description>
      <pubDate>Mon, 05 Mar 2018 20:36:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-in-proc-sql/m-p/442616#M282766</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2018-03-05T20:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: macro in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-in-proc-sql/m-p/442619#M282767</link>
      <description>&lt;P&gt;You’re missing the semicolon to end your first SELECT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 20:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-in-proc-sql/m-p/442619#M282767</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-05T20:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: macro in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-in-proc-sql/m-p/442621#M282768</link>
      <description>&lt;P&gt;if the purpose of the second select statement is to restrict the data then it is 1) out of order and 2) likely needs parentheses:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you are missing a semicolon between two separate queries&lt;/P&gt;
&lt;PRE&gt;proc sql ;
create table &amp;amp;visit.2 as 
select count (distinct internal_visit_id) AS counttime, 1360 AS TIME_POINT_CONTRACTED
from &amp;amp;visit.1
where Earliest_Visit_Date ne . &lt;FONT color="#ff0000"&gt;;&lt;/FONT&gt;

select counttime , TIME_POINT_CONTRACTED into :counttimet, :timecont from  &amp;amp;visit.2;    
quit; &lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Mar 2018 20:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-in-proc-sql/m-p/442621#M282768</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-05T20:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: macro in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-in-proc-sql/m-p/442730#M282769</link>
      <description>&lt;P&gt;I find that you can prevent some of these types of mistakes by getting in the habit of formatting multi-line statements similar to how you would format a multiple line DO/END block.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;If 0=nmiss(x,y) then do;
   diff = x-y ;
   percent = diff/y ;
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That is place the termination code (the semi-colon) on the last line by itself.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
create table &amp;amp;visit.2 as 
  select count (distinct internal_visit_id) AS counttime
      , 1360 AS TIME_POINT_CONTRACTED
  from &amp;amp;visit.1
  where Earliest_Visit_Date ne .
;
select counttime , TIME_POINT_CONTRACTED into :counttimet, :timecont 
  from  &amp;amp;visit.2
;
quit; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 05:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-in-proc-sql/m-p/442730#M282769</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-03-06T05:00:25Z</dc:date>
    </item>
  </channel>
</rss>

