<?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: need to change proc sql code into data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806458#M317739</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data gxhi2; /* create this new dataset */
set gxhi1; /* read all variables from this dataset */
if _n_ = 1 /* in the first iteration of the data step */
then do;
  /* define a hash object */
  declare hash p (dataset:"prod_pol_mapping (keep=product_type rename=(product_type=prodtype))");
  /* define the object from a dataset where we keep one variable and rename it, so the names fit */
  p.definekey("prodtype"); /* define the single variable as key */
  p.definedata("prodtype"); /* and also as data, this reduces the memory footprint of the object */
  p.definedone(); /* definition complete */
end;
if p.check() = 0; /* the check method returns a zero when an entry is found */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 07 Apr 2022 10:15:05 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-04-07T10:15:05Z</dc:date>
    <item>
      <title>need to change proc sql code into data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806444#M317733</link>
      <description>&lt;P&gt;Hi sir,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this code is taking almost 3 hour to complete when i&amp;nbsp; ran it .&lt;/P&gt;
&lt;P&gt;that why i want to change this code in data step so that it will take less time could you pls help me with this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table gxhi2 as select * from gxhi1&lt;BR /&gt;where exists (select 1 from PROD_POL_MAPPING where PRODTYP = PROD_POL_MAPPING.Product_Type) ;*/&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 08:18:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806444#M317733</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2022-04-07T08:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: need to change proc sql code into data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806447#M317735</link>
      <description>&lt;P&gt;Use a hash:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data gxhi2;
set gxhi1;
if _n_ = 1
then do;
  declare hash p (dataset:"prod_pol_mapping (keep=product_type rename=(product_type=prodtype))");
  p.definekey("prodtype");
  p.definedata("prodtype");
  p.definedone();
end;
if p.check() = 0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(assuming that prodtype is a variable in gxhi1)&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 08:29:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806447#M317735</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-07T08:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: need to change proc sql code into data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806448#M317736</link>
      <description>&lt;P&gt;PS&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select 1 from PROD_POL_MAPPING &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is very dangerous; if the order of variables in PROD_POL_MAPPING changes for whatever reason, this will not work as desired (but might not even issue a NOTE). Always address variables by name.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 08:34:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806448#M317736</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-07T08:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: need to change proc sql code into data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806453#M317737</link>
      <description>&lt;P&gt;Could you pls explain this code&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 09:07:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806453#M317737</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2022-04-07T09:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: need to change proc sql code into data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806458#M317739</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data gxhi2; /* create this new dataset */
set gxhi1; /* read all variables from this dataset */
if _n_ = 1 /* in the first iteration of the data step */
then do;
  /* define a hash object */
  declare hash p (dataset:"prod_pol_mapping (keep=product_type rename=(product_type=prodtype))");
  /* define the object from a dataset where we keep one variable and rename it, so the names fit */
  p.definekey("prodtype"); /* define the single variable as key */
  p.definedata("prodtype"); /* and also as data, this reduces the memory footprint of the object */
  p.definedone(); /* definition complete */
end;
if p.check() = 0; /* the check method returns a zero when an entry is found */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 10:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806458#M317739</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-07T10:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: need to change proc sql code into data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806483#M317752</link>
      <description>&lt;P&gt;Thanks a ton&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 12:24:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-proc-sql-code-into-data-step/m-p/806483#M317752</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2022-04-07T12:24:09Z</dc:date>
    </item>
  </channel>
</rss>

