<?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/64848#M14093</link>
    <description>Filp,&lt;BR /&gt;
I'm getting this warning:&lt;BR /&gt;
3755    proc sql;&lt;BR /&gt;
3756  create table final as&lt;BR /&gt;
3757      select *,&lt;BR /&gt;
3758         case&lt;BR /&gt;
3759        when d1.physician_name eq d2.phys_name   then . else  totalscripts&lt;BR /&gt;
3760    end as totalscripts&lt;BR /&gt;
3761        from main d1 left outer join pdrp d2 on&lt;BR /&gt;
3761! d1.physician_name=d2.phys_name;&lt;BR /&gt;
WARNING: Variable totalscripts already exists on file WORK.FINAL.</description>
    <pubDate>Fri, 14 Aug 2009 18:59:42 GMT</pubDate>
    <dc:creator>SASPhile</dc:creator>
    <dc:date>2009-08-14T18:59:42Z</dc:date>
    <item>
      <title>Proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql/m-p/64846#M14091</link>
      <description>I have two tables. Main and pdrp.&lt;BR /&gt;
If the physicians in the main table are present in the pdrp table then totalscripts should not be displayed(set them to .)  else they will have the original number.To achieve this I used the following code. This is not giving the expected result.i.e it is not changing the value of totalscripts to . &lt;BR /&gt;
Any help is appreciated.&lt;BR /&gt;
  proc sql;&lt;BR /&gt;
create table crmrk_combine_bsm_final as&lt;BR /&gt;
    select *,&lt;BR /&gt;
       case&lt;BR /&gt;
      when d1.physician_name eq d2.phys_name   then  totalscripts=.  else  totalscripts=totalscripts&lt;BR /&gt;
  end &lt;BR /&gt;
      from main d1 left outer join pdrp d2 on d1.physician_name=d2.phys_name;&lt;BR /&gt;
quit;</description>
      <pubDate>Fri, 14 Aug 2009 18:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql/m-p/64846#M14091</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-08-14T18:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql/m-p/64847#M14092</link>
      <description>case &lt;BR /&gt;
    when d1.physician_name eq d2.phys_name then =. &lt;BR /&gt;
    else totalscripts&lt;BR /&gt;
end as totalscripts&lt;BR /&gt;
&lt;BR /&gt;
You wrote it in datastep speak.</description>
      <pubDate>Fri, 14 Aug 2009 18:51:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql/m-p/64847#M14092</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-08-14T18:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql/m-p/64848#M14093</link>
      <description>Filp,&lt;BR /&gt;
I'm getting this warning:&lt;BR /&gt;
3755    proc sql;&lt;BR /&gt;
3756  create table final as&lt;BR /&gt;
3757      select *,&lt;BR /&gt;
3758         case&lt;BR /&gt;
3759        when d1.physician_name eq d2.phys_name   then . else  totalscripts&lt;BR /&gt;
3760    end as totalscripts&lt;BR /&gt;
3761        from main d1 left outer join pdrp d2 on&lt;BR /&gt;
3761! d1.physician_name=d2.phys_name;&lt;BR /&gt;
WARNING: Variable totalscripts already exists on file WORK.FINAL.</description>
      <pubDate>Fri, 14 Aug 2009 18:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql/m-p/64848#M14093</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-08-14T18:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql/m-p/64849#M14094</link>
      <description>That is due to the select *.  One of the drawbacks to SQL is there is no drop statement.  So you are assigning totalscripts twice.  Either spell out all the vars you want, leaving out totalscripts  or use a different var name and fix that in another step.&lt;BR /&gt;
&lt;BR /&gt;
You could also do :&lt;BR /&gt;
&lt;BR /&gt;
Update table main set totalscripts = . where physician_name in &lt;BR /&gt;
(select phys_name from pdrp);</description>
      <pubDate>Fri, 14 Aug 2009 19:12:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql/m-p/64849#M14094</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-08-14T19:12:41Z</dc:date>
    </item>
  </channel>
</rss>

