<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/801852#M315601</link>
    <description>&lt;P&gt;SELECT INTO is the method to create macro variables from SQL. So your step creates macro variable &amp;amp;total which holds the count of all observations in the dataset porto.&lt;/P&gt;
&lt;P&gt;The DISTINCT in your query serves no purpose (there is only one count anyway), so remove it. Without a CREATE TABLE, only the macro variable and the print output are created. When the sole purpose of the step is to create the macro variable, run PROC SQL with the NOPRINT option.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Mar 2022 06:25:41 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-03-14T06:25:41Z</dc:date>
    <item>
      <title>proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/801849#M315599</link>
      <description>&lt;PRE&gt;data Porto;
input apple lemon orange;
datalines;
1 2 3
2 3 4
3 4 5
1 5 5
3 0 0
6 0 0
7 0 0
run;

PROC SQL;
create table result as
SELECT DISTINCT count(*) into :total
FROM Porto;
QUIT;

proc print data=result;
run;&lt;/PRE&gt;
&lt;P&gt;if I skip the line "create table result as" Is the code not gonna to save any output? is it just gonna showing in the log whatever is identified?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what does count(*) into :total means? is it just total number of rows in table Porto? what is :total? this is looking very strange I tried the code and the output is very strange too...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HeatherNewton_0-1647146513271.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69428i3C8A12B75CE0E6AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HeatherNewton_0-1647146513271.png" alt="HeatherNewton_0-1647146513271.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Mar 2022 04:47:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/801849#M315599</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-03-13T04:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/801852#M315601</link>
      <description>&lt;P&gt;SELECT INTO is the method to create macro variables from SQL. So your step creates macro variable &amp;amp;total which holds the count of all observations in the dataset porto.&lt;/P&gt;
&lt;P&gt;The DISTINCT in your query serves no purpose (there is only one count anyway), so remove it. Without a CREATE TABLE, only the macro variable and the print output are created. When the sole purpose of the step is to create the macro variable, run PROC SQL with the NOPRINT option.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 06:25:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/801852#M315601</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-14T06:25:41Z</dc:date>
    </item>
  </channel>
</rss>

