<?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: A macro to activate a group of saved files in work library in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320861#M3167</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1991"&gt;@Reza&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;Do you have any suggestion how to fix the problem?&lt;/P&gt;
&lt;P&gt;I have the files names in LIST and want to have a macro loop to go through the list, read a name and activate a saved file with that name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't know what activate a dataset means. If it's an IML term that's likely why.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Dec 2016 04:03:22 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-12-23T04:03:22Z</dc:date>
    <item>
      <title>A macro to activate a group of saved files in work library</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320854#M3162</link>
      <description>&lt;P&gt;I am trying to write a piece of code that reads a number of files from a SAS library (named it: indexadd) and activate them in the work library. LIST contains the names of files to be transferred to the work environment. There are 253 saved files and I want to write a macro loop to go through the list and read and activate files one by one. This is what I have written. When I use print &amp;amp;Tick in IML section I can see that the correct names have been allocated to &amp;amp;Tick. E.g. ABB, NIM, ...&lt;/P&gt;
&lt;P&gt;But, apparently in the second section my code fails to identify the correct names and I receive the following error message:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WARNING: Physical file does not exist.&lt;BR /&gt;ERROR: Cannot open %INCLUDE file TICK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I appreciate any suggestion to tackle this problem.&lt;/P&gt;
&lt;P&gt;Cheers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data List; /*Activate List file*/&lt;BR /&gt;set Indexadd.List;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;%macro DataActivate; /* Creating a Macro Loop to activate files from Library*/&lt;BR /&gt;&lt;BR /&gt;%do i=1 %to 253;&lt;BR /&gt;&lt;BR /&gt;Proc IML; &lt;BR /&gt;use List;&lt;BR /&gt;&amp;nbsp; read all var _char_ into List_Char;&lt;BR /&gt;&amp;nbsp; mattrib List_Char colname={'Ticker'};&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Tick=List_Char[&amp;amp;i,1];&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%let Tick=%bquote(Tick);&lt;BR /&gt;print &amp;amp;Tick;&lt;BR /&gt;Quit;&lt;BR /&gt;&lt;BR /&gt;data &amp;amp;Tick;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%include &amp;amp;Tick;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ticker = "&amp;amp;Tick";&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;%END;&lt;BR /&gt;%mend;&lt;BR /&gt;%DataActivate run;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 01:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320854#M3162</guid>
      <dc:creator>Reza</dc:creator>
      <dc:date>2016-12-23T01:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: A macro to activate a group of saved files in work library</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320857#M3163</link>
      <description>&lt;P&gt;Macro variables have scope. It won't exist outside of the macro unless you've created it as a GLOBAL macro variable.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 03:10:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320857#M3163</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-23T03:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: A macro to activate a group of saved files in work library</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320858#M3164</link>
      <description>&lt;P&gt;Also, %include tick may not do what you want...not sure what values will be in there or what you're trying to do.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 03:16:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320858#M3164</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-23T03:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: A macro to activate a group of saved files in work library</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320859#M3165</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;Do you have any suggestion how to fix the problem?&lt;/P&gt;
&lt;P&gt;I have the files names in LIST and want to have a macro loop to go through the list, read a name and activate a saved file with that name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 03:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320859#M3165</guid>
      <dc:creator>Reza</dc:creator>
      <dc:date>2016-12-23T03:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: A macro to activate a group of saved files in work library</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320860#M3166</link>
      <description>&lt;PRE&gt;
You don't need MACRO , Check this :

http://blogs.sas.com/content/iml/2015/11/02/search-all-variables.html

&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Dec 2016 03:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320860#M3166</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-12-23T03:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: A macro to activate a group of saved files in work library</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320861#M3167</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1991"&gt;@Reza&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;Do you have any suggestion how to fix the problem?&lt;/P&gt;
&lt;P&gt;I have the files names in LIST and want to have a macro loop to go through the list, read a name and activate a saved file with that name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't know what activate a dataset means. If it's an IML term that's likely why.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 04:03:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320861#M3167</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-23T04:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: A macro to activate a group of saved files in work library</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320862#M3168</link>
      <description>&lt;P&gt;Not sure if this is applicable, but You can use PROC DATASETS to copy datasets from a library to the work library in one shot.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 04:04:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320862#M3168</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-23T04:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: A macro to activate a group of saved files in work library</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320919#M3169</link>
      <description>&lt;P&gt;It is not clear to me what you are trying to accomplish. "Activate" is not a term I have ever heard. Do you mean "copy"? What is in the %INCLUDE file? Are the include files already created &amp;nbsp;in the current working directory?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One thing is clear: &amp;nbsp;you need to read the article &lt;A href="http://blogs.sas.com/content/iml/2013/06/19/macros-and-loops.html" target="_self"&gt;"Macros and loops in the&amp;nbsp;SAS/IML&amp;nbsp;language."&lt;/A&gt;&amp;nbsp; The article explains why you should use SYMPUT instead of %LET.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is hard fo r me to recommend a solution when I don't understand what you are trying to accomplish, but let me suggest that you investigate rewriting the program to use the SUBMIT statement to pass in the parameter to the DATA&amp;nbsp;step directly, as shown in the article &lt;A href="http://blogs.sas.com/content/iml/2013/06/03/passing-values-into-procedures.html" target="_self"&gt;"Passing values from PROC IML into SAS procedures."&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The program might look something like this (untested):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc IML; 
use List;
  read all var _char_ into List_Char;
  mattrib List_Char colname={'Ticker'};
  do i=1 to 253;
    Tick=List_Char[i,1];
       submit Tick;
          data &amp;amp;Tick;
          %include "&amp;amp;Tick";
         ticker = "&amp;amp;Tick";
         run;
      endsubmit;
  end;
close List;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 12:33:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-macro-to-activate-a-group-of-saved-files-in-work-library/m-p/320919#M3169</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-12-23T12:33:16Z</dc:date>
    </item>
  </channel>
</rss>

