<?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 Proc SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/463219#M117972</link>
    <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can&amp;nbsp; pls explain the below code. My doubt is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;var.sec_terc&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;EM&gt;&lt;STRONG&gt;--&amp;gt; is this a table or column name?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;from DET_CT var&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/U&gt;&lt;STRONG&gt;&lt;EM&gt;--&amp;gt; What it is actually? If table, above one is column name is it?&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table CT_M. as select&lt;BR /&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;var.sec_terc&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;BR /&gt;,max (case when (var.mod_r in ('01') and var.CAL IN ('P') and FEC_COR_R BETWEEN intnx('month', "&amp;amp;PAR_FEC_H"d, -2, 'end')&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;AND intnx('month', "&amp;amp;PAR_FEC_H"d, -4, 'begin') and var.edad_m_r&amp;gt;=0) then min(12,var.edad_m_r) else . end) as C_150&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;from DET_CT var&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/U&gt;&lt;BR /&gt;where var.CALIDAD IN ('P' 'C' 'S' 'A')&lt;BR /&gt;and var.ESTADO_R not in ('7' '07' ' 7' '7 ' '70')&lt;BR /&gt;group by var.&lt;SPAN&gt;sec_terc&lt;/SPAN&gt;;&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Fri, 18 May 2018 06:58:22 GMT</pubDate>
    <dc:creator>c4shiva</dc:creator>
    <dc:date>2018-05-18T06:58:22Z</dc:date>
    <item>
      <title>Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/463219#M117972</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can&amp;nbsp; pls explain the below code. My doubt is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;var.sec_terc&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;EM&gt;&lt;STRONG&gt;--&amp;gt; is this a table or column name?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;from DET_CT var&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/U&gt;&lt;STRONG&gt;&lt;EM&gt;--&amp;gt; What it is actually? If table, above one is column name is it?&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table CT_M. as select&lt;BR /&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;var.sec_terc&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;BR /&gt;,max (case when (var.mod_r in ('01') and var.CAL IN ('P') and FEC_COR_R BETWEEN intnx('month', "&amp;amp;PAR_FEC_H"d, -2, 'end')&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;AND intnx('month', "&amp;amp;PAR_FEC_H"d, -4, 'begin') and var.edad_m_r&amp;gt;=0) then min(12,var.edad_m_r) else . end) as C_150&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;from DET_CT var&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/U&gt;&lt;BR /&gt;where var.CALIDAD IN ('P' 'C' 'S' 'A')&lt;BR /&gt;and var.ESTADO_R not in ('7' '07' ' 7' '7 ' '70')&lt;BR /&gt;group by var.&lt;SPAN&gt;sec_terc&lt;/SPAN&gt;;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 06:58:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/463219#M117972</guid>
      <dc:creator>c4shiva</dc:creator>
      <dc:date>2018-05-18T06:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/463222#M117974</link>
      <description>&lt;P&gt;I really suggest you look up some SQL help as this is pretty basic.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.w3schools.com/sql/" target="_blank"&gt;https://www.w3schools.com/sql/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Point 2 first.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;from det_ct var&lt;/P&gt;
&lt;P&gt;What this does is it tells the compiler to take data from dataset det_ct, which is by default in the work library as no library specified, and assign to this data the alias var.&amp;nbsp; Therefore to refer to any variables from this dataset I use the alias var.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Point 1.&lt;/P&gt;
&lt;P&gt;var.sec_terc&lt;/P&gt;
&lt;P&gt;This leads on from the above point, where an alias var has been created to refer to the det_ct dataset.&amp;nbsp; It is effectively saying the variable from det_ct which is referenced by alias var.&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 07:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/463222#M117974</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-18T07:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/463738#M118195</link>
      <description>Thank you so much ... now am clear... Am a fresher just started to learn SAS from google. Thanks again for your link.. very helpful.</description>
      <pubDate>Mon, 21 May 2018 09:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/463738#M118195</guid>
      <dc:creator>c4shiva</dc:creator>
      <dc:date>2018-05-21T09:26:32Z</dc:date>
    </item>
  </channel>
</rss>

