<?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: datastep and procstep - small question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570630#M160934</link>
    <description>Second option, you can add quotes to each element, there's a function, QUOTE().</description>
    <pubDate>Tue, 02 Jul 2019 16:28:38 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-07-02T16:28:38Z</dc:date>
    <item>
      <title>datastep and procstep - small question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570579#M160913</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While doing my project I do see two ways of dealing with my SAS objects.&lt;/P&gt;&lt;P&gt;Seems 2nd way is preferred(seems it works faster) but can you say, am I correct with it or not?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table t1 (id int, typ char(3), qty int);
insert into t1 
	values (1, 'aas', 50)
	values (2, 'aaf', 15)
	values (3, 'aaa', 50)
	values (4, 'abd', 5)
	values (5, 'asa', 25)
	values (6, 'afa', 5)
	values (7, 'aba', 15);
quit;

data d1;
input qty2;
datalines;
5
15
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;first option:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; create table want as select * from t1 where qty in (select qty2 from d1); quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;second option:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint; select qty2 into: qty3 separated by "," from d1; quit;
proc sql; create table want as select * from t1 where qty in (&amp;amp;qty3); quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THX!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 14:22:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570579#M160913</guid>
      <dc:creator>Ivan555</dc:creator>
      <dc:date>2019-07-02T14:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: datastep and procstep - small question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570617#M160928</link>
      <description>Yes, in general, the second method is faster, but it doesn't always scale well if the WHERE condition gets more complicated or if the macro variable gets too long you'll need to find a work around. A macro variable can hold 65K characters but you can also generate those values via a macro. I believe a hash is ultimately the fastest for filters if you're looking for efficiency.</description>
      <pubDate>Tue, 02 Jul 2019 15:49:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570617#M160928</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-02T15:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: datastep and procstep - small question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570621#M160930</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Understood, thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can't you say, if I am doing same with char, where is the mistake?&lt;/P&gt;&lt;P&gt;I tryed, but I am getting an error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;63 aas, aaf&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR 79-332: Expecting a SELECT&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR 79-332: Syntax error, statement will be ignored.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data d2;&lt;BR /&gt;input typ2 $;&lt;BR /&gt;datalines;&lt;BR /&gt;aas&lt;BR /&gt;aaf&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt; noprint&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; typ2 &lt;SPAN class="token keyword"&gt;into&lt;/SPAN&gt;: typ3 separated &lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;","&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; d2&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; create &lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; want as &lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; t1 &lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; typ &lt;SPAN class="token operator"&gt;in&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;typ3&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 16:12:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570621#M160930</guid>
      <dc:creator>Ivan555</dc:creator>
      <dc:date>2019-07-02T16:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: datastep and procstep - small question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570624#M160931</link>
      <description>You didn't generate valid SAS code there. &lt;BR /&gt;&lt;BR /&gt;When you select characters they need to be in quotes and you created a macro variable without quotes. &lt;BR /&gt;&lt;BR /&gt;select * from class where name in (Alfred, Jane, Jim) is what you're using and that isn't valid SAS code. &lt;BR /&gt;&lt;BR /&gt;With quotes, this is correct:&lt;BR /&gt;&lt;BR /&gt;select * from class where name in ("Alfred", "Jane", "Jim")&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Jul 2019 16:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570624#M160931</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-02T16:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: datastep and procstep - small question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570629#M160933</link>
      <description>&lt;P&gt;Sorry, you mean because of presence the data in datastep without quotes it cannot being used in macro variables, right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or it is possible to somehow add quotes to each element in macro variable?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 16:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570629#M160933</guid>
      <dc:creator>Ivan555</dc:creator>
      <dc:date>2019-07-02T16:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: datastep and procstep - small question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570630#M160934</link>
      <description>Second option, you can add quotes to each element, there's a function, QUOTE().</description>
      <pubDate>Tue, 02 Jul 2019 16:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570630#M160934</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-02T16:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: datastep and procstep - small question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570631#M160935</link>
      <description>when you're writing macros make sure to use the proper debugging options so that your log has enough information for you to see what's going on:&lt;BR /&gt;&lt;BR /&gt;options mprint symbolgen;&lt;BR /&gt;&lt;BR /&gt;MLOGIC is another option that can be useful when things aren't working well, but I also find it can really clutter up your log.</description>
      <pubDate>Tue, 02 Jul 2019 16:29:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570631#M160935</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-02T16:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: datastep and procstep - small question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570632#M160936</link>
      <description>&lt;P&gt;It works!&lt;/P&gt;&lt;P&gt;Thank you much, Reeza!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 16:30:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570632#M160936</guid>
      <dc:creator>Ivan555</dc:creator>
      <dc:date>2019-07-02T16:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: datastep and procstep - small question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570635#M160938</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;when you're writing macros make sure to use the proper debugging options so that your log has enough information for you to see what's going on:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;options mprint symbolgen;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;MLOGIC is another option that can be useful when things aren't working well, but I also find it can really clutter up your log.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you, I will study these options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 16:38:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datastep-and-procstep-small-question/m-p/570635#M160938</guid>
      <dc:creator>Ivan555</dc:creator>
      <dc:date>2019-07-02T16:38:07Z</dc:date>
    </item>
  </channel>
</rss>

