<?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: SQL to SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518609#M140381</link>
    <description>&lt;P&gt;Depending on dataset sizes, you might be able to use memory-based techniques (format, hash object).&lt;/P&gt;</description>
    <pubDate>Wed, 05 Dec 2018 00:12:03 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-12-05T00:12:03Z</dc:date>
    <item>
      <title>SQL to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518479#M140324</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Can someone advise how I would write the SQL code below in SAS? I am not aware of SQL and how to read the programs accurately and then perform the associated actions in SAS&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE CR_FY1217 AS&lt;BR /&gt;SELECT DISTINCT&lt;BR /&gt;CASE&lt;BR /&gt;WHEN '01APR2012'D&amp;lt;=DATEPART(REMOVALDATE)&amp;lt;='31MAR2013'D THEN 2012&lt;BR /&gt;WHEN '01APR2013'D&amp;lt;=DATEPART(REMOVALDATE)&amp;lt;='31MAR2014'D THEN 2013&lt;BR /&gt;WHEN '01APR2014'D&amp;lt;=DATEPART(REMOVALDATE)&amp;lt;='31MAR2015'D THEN 2014&lt;BR /&gt;WHEN '01APR2015'D&amp;lt;=DATEPART(REMOVALDATE)&amp;lt;='31MAR2016'D THEN 2015&lt;BR /&gt;WHEN '01APR2016'D&amp;lt;=DATEPART(REMOVALDATE)&amp;lt;='31MAR2017'D THEN 2016&lt;BR /&gt;WHEN '01APR2017'D&amp;lt;=DATEPART(REMOVALDATE)&amp;lt;='31MAR2018'D THEN 2017&lt;BR /&gt;ELSE .&lt;BR /&gt;END AS FYEAR,&lt;BR /&gt;DATEPART(REMOVALDATE) AS REMOVAL_DT FORMAT=DATE9.,&lt;BR /&gt;A.WAITTIMEPATIENTID,&lt;BR /&gt;A.WAITTIMEPROCEDURECD,&lt;BR /&gt;A.WAITLISTENTRYID,&lt;BR /&gt;A.PRIORITYLEVELCD,&lt;BR /&gt;B.GENDERCD,&lt;BR /&gt;B.ADDRESSUNAVAILABLEIND,&lt;BR /&gt;SUM(C.COUNTRYCD='CAN')&amp;gt;0 AS FLAG_CANADA, /* MULTIPLE PROVINCE RECORDS */&lt;BR /&gt;SUM(C.PROVINCECD='CA-ON')&amp;gt;0 AS FLAG_ONTARIO, /* MULTIPLE PROVINCE RECORDS */&lt;BR /&gt;F.CAUSEOFDEATHCD,&lt;BR /&gt;F.PLACEOFDEATHCD,&lt;BR /&gt;F.DEATHWITHINSAMEREGIONCARECD,&lt;BR /&gt;F.AUTOPSYCD&lt;BR /&gt;FROM CHO1.CARDIACWAITLISTENTRY AS A&lt;BR /&gt;LEFT JOIN CHO1.WAITTIMEPATIENT AS B&lt;BR /&gt;ON A.WAITTIMEPATIENTID=B.WAITTIMEPATIENTID&lt;BR /&gt;LEFT JOIN CHO1.WAITTIMEPATIENTADDRESS AS C&lt;BR /&gt;ON A.WAITTIMEPATIENTID=C.WAITTIMEPATIENTID&lt;BR /&gt;LEFT JOIN CHO1.WAITLISTENTRYCANCELLATION AS D&lt;BR /&gt;ON A.WAITLISTENTRYID=D.WAITLISTENTRYID&lt;BR /&gt;LEFT JOIN CHO1.CARDIACOFFLISTINGDETAILS AS E&lt;BR /&gt;ON A.WAITLISTENTRYID=E.WAITLISTENTRYID&lt;BR /&gt;LEFT JOIN CHO1.CARDIACSURVEILLANCESUMMARY AS F&lt;BR /&gt;ON E.CARDIACOFFLISTINGDETAILSID=F.CARDIACOFFLISTINGDETAILSID&lt;BR /&gt;GROUP BY A.WAITLISTENTRYID&lt;BR /&gt;HAVING '01APR2012'D&amp;lt;=REMOVAL_DT&amp;lt;='31MAR2018'D&lt;BR /&gt;ORDER BY REMOVAL_DT;&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2018 16:49:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518479#M140324</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-04T16:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: SQL to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518492#M140331</link>
      <description>That is SAS code. Rewriting this in a data step would be a fairly difficult thing to do. You're merging 6/7 tables with different keys, and each set of different keys means a new data step. PROC SQL is most definitely the best solution in this case. &lt;BR /&gt;&lt;BR /&gt;It's worth doing some reading on SQL, if you're familiar with data analysis, a day will let you learn about 80% of what you need for SQL. &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www2.sas.com/proceedings/sugi27/p191-27.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi27/p191-27.pdf&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Webinar/video:&lt;BR /&gt;&lt;A href="https://www.sas.com/en_us/webinars/sql-introduction/register.html" target="_blank"&gt;https://www.sas.com/en_us/webinars/sql-introduction/register.html&lt;/A&gt;</description>
      <pubDate>Tue, 04 Dec 2018 17:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518492#M140331</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-04T17:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: SQL to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518502#M140334</link>
      <description>Thankyou !! Apprecite it</description>
      <pubDate>Tue, 04 Dec 2018 17:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518502#M140334</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-04T17:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: SQL to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518523#M140343</link>
      <description>what does it mean when you say group by 1 or 2 what do the numbers stand for in a sql code?</description>
      <pubDate>Tue, 04 Dec 2018 18:49:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518523#M140343</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-04T18:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: SQL to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518525#M140345</link>
      <description>&lt;P&gt;1 and 2 are positional indicators that refer to the first and second variable in the table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/240770"&gt;@Ranjeeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;what does it mean when you say group by 1 or 2 what do the numbers stand for in a sql code?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2018 18:52:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518525#M140345</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-04T18:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: SQL to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518609#M140381</link>
      <description>&lt;P&gt;Depending on dataset sizes, you might be able to use memory-based techniques (format, hash object).&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 00:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-to-SAS/m-p/518609#M140381</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-05T00:12:03Z</dc:date>
    </item>
  </channel>
</rss>

