<?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 distinct statement in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/distinct-statement/m-p/818061#M34580</link>
    <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
&lt;P&gt;I am trying to find the distinct phone numbers but getting sytax error. Could you check and let me know what is causing this error?&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table Tele_numbers as 
select a.*,
distinct b.tnphone as telephone,
case when
b.tnphone is not null then 'Y' else 'N'
end as Number_available
from Repcodes as a
Inner join
p2scflow.telephonenumbers as b on a.Accounts_number = b.tnkey;
quit;

Error:


29         proc sql;
30         create table Tele_numbers as
31         select a.*,
32         
33         distinct b.tnphone as telephone,
                    _
                    22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, (, *, **, +, ',', -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, BETWEEN, 
              CONTAINS, EQ, EQT, FROM, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.  

34         case when
35         b.tnphone is not null then 'Y' else 'N'
36         end as Number_available
37         from Repcodes as a
38         Inner join
39         p2scflow.telephonenumbers as b on a.Accounts_number = b.tnkey;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
40         quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 Jun 2022 12:20:01 GMT</pubDate>
    <dc:creator>Sandeep77</dc:creator>
    <dc:date>2022-06-14T12:20:01Z</dc:date>
    <item>
      <title>distinct statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/distinct-statement/m-p/818061#M34580</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
&lt;P&gt;I am trying to find the distinct phone numbers but getting sytax error. Could you check and let me know what is causing this error?&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table Tele_numbers as 
select a.*,
distinct b.tnphone as telephone,
case when
b.tnphone is not null then 'Y' else 'N'
end as Number_available
from Repcodes as a
Inner join
p2scflow.telephonenumbers as b on a.Accounts_number = b.tnkey;
quit;

Error:


29         proc sql;
30         create table Tele_numbers as
31         select a.*,
32         
33         distinct b.tnphone as telephone,
                    _
                    22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, (, *, **, +, ',', -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, BETWEEN, 
              CONTAINS, EQ, EQT, FROM, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.  

34         case when
35         b.tnphone is not null then 'Y' else 'N'
36         end as Number_available
37         from Repcodes as a
38         Inner join
39         p2scflow.telephonenumbers as b on a.Accounts_number = b.tnkey;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
40         quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jun 2022 12:20:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/distinct-statement/m-p/818061#M34580</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2022-06-14T12:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: distinct statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/distinct-statement/m-p/818062#M34581</link>
      <description>&lt;P&gt;The DISTINCT keyword applies to the entire observation.&amp;nbsp; Place it before the variable list, not in the middle.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 12:27:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/distinct-statement/m-p/818062#M34581</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-14T12:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: distinct statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/distinct-statement/m-p/818074#M34583</link>
      <description>&lt;P&gt;Also, adding a.* would probably give a lot more records than you desire, if you want a neat least of unique phone numbers.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 13:36:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/distinct-statement/m-p/818074#M34583</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2022-06-14T13:36:21Z</dc:date>
    </item>
  </channel>
</rss>

