<?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 Use Macro list in DI Studio extract transformation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Use-Macro-list-in-DI-Studio-extract-transformation/m-p/691189#M210338</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would someone be able to help me with the following issue I have.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use proc sql into method in pre code to make &amp;amp;id_list separated by , .&lt;/P&gt;&lt;P&gt;This gives me the following list for example 1234, 1345, 1456, 1567&lt;/P&gt;&lt;P&gt;I have a numeric id column where i would like to use the list something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where&amp;nbsp;put(id,8.) in("&amp;amp;id_list."').&lt;/P&gt;&lt;P&gt;I get no results. I believe that the list elements should be like this '1234', '1345', '1456', '1567'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OR i should be able to change list to numeric but not sure if possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the question is how to manipulate the list element to have ' ' ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Br&lt;/P&gt;&lt;P&gt;Matti&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Oct 2020 10:20:41 GMT</pubDate>
    <dc:creator>MattiL</dc:creator>
    <dc:date>2020-10-13T10:20:41Z</dc:date>
    <item>
      <title>Use Macro list in DI Studio extract transformation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-Macro-list-in-DI-Studio-extract-transformation/m-p/691189#M210338</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would someone be able to help me with the following issue I have.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use proc sql into method in pre code to make &amp;amp;id_list separated by , .&lt;/P&gt;&lt;P&gt;This gives me the following list for example 1234, 1345, 1456, 1567&lt;/P&gt;&lt;P&gt;I have a numeric id column where i would like to use the list something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where&amp;nbsp;put(id,8.) in("&amp;amp;id_list."').&lt;/P&gt;&lt;P&gt;I get no results. I believe that the list elements should be like this '1234', '1345', '1456', '1567'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OR i should be able to change list to numeric but not sure if possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the question is how to manipulate the list element to have ' ' ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Br&lt;/P&gt;&lt;P&gt;Matti&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 10:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-Macro-list-in-DI-Studio-extract-transformation/m-p/691189#M210338</guid>
      <dc:creator>MattiL</dc:creator>
      <dc:date>2020-10-13T10:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Use Macro list in DI Studio extract transformation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-Macro-list-in-DI-Studio-extract-transformation/m-p/691203#M210345</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You do have an extra single quote just before the closing bracket:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where put(id,8.) in("&amp;amp;id_list."');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might not need to perform any conversions or use any quotes. Have you tried something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where id in (&amp;amp;id_list.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really want quotes around the values in your list then when you use SQL to create the list then you could try using the &lt;FONT face="courier new,courier"&gt;quote()&lt;/FONT&gt; function, e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select quote(cats(id)) into :id_list separated by ','
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As &lt;FONT face="courier new,courier"&gt;quote()&lt;/FONT&gt; requires a string I also used the &lt;FONT face="courier new,courier"&gt;cats()&lt;/FONT&gt; function to convert &lt;FONT face="courier new,courier"&gt;id&lt;/FONT&gt; to a string and then strip the result of leading and trailing spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try displaying the result of your &lt;FONT face="courier new,courier"&gt;put()&lt;/FONT&gt; conversion and you might find you have leading spaces which could reduce the chances of finding a match in the list. Also display the value of &lt;FONT face="courier new,courier"&gt;&amp;amp;id_list&lt;/FONT&gt; to make sure it looks like what you expect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edited for typo and formatting.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 11:21:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-Macro-list-in-DI-Studio-extract-transformation/m-p/691203#M210345</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2020-10-13T11:21:49Z</dc:date>
    </item>
  </channel>
</rss>

