<?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: Data step inside IML in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Data-step-inside-IML/m-p/445797#M4077</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The reason for this is that i need to manipulate the data by joining, inserting new variables and summing in order to reduce the size of the matrix calculations&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This can all be done in IML code. No need for a datastep here.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I also need to do this (in some way) within a loop as I'm sampling data for each iteration.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This can all be done in an IML loop&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Mar 2018 12:07:26 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-03-15T12:07:26Z</dc:date>
    <item>
      <title>Data step inside IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Data-step-inside-IML/m-p/445761#M4075</link>
      <description>&lt;P&gt;This might be a long and stupid question...My goal is to either find a way to do what i want or understand why I can't/shouldn't do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on a project where I need to include some data steps inside a loop that I have created using IML.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason for this is that i need to manipulate the data by joining, inserting new variables and summing in order to reduce the size of the matrix calculations. I also need to do this (in some way) within a loop as I'm sampling data for each iteration. Firstly, as I'm new to using IML, is there a reason why it is not possible to just insert a data step in the middle of my IML code? I don't think it would be impossible to recreate the steps I've done using IML but I'd rather not do it. Is there a way to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To clarify I want something like this:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc iml;&lt;BR /&gt;iter = 5;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do i=1 to iter;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* proc surveyselect data...*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*data steps*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*import variables from last data step to vectors*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* matrix calculations */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems to work using a macro and looping outside i.e:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro func();&lt;/P&gt;&lt;P&gt;%do iter=1 %to 5;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*data steps*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;/*import variables from last data step to vectors*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* matrix calculations */&lt;/P&gt;&lt;P&gt;;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%func();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to avoid this however as it less similar to the method i'm trying to implement and not as intuitive (in a mathematical sense). And a more vain reason is that I hate that all the color coding disappears when working inside a macro... maybe this is removable?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 09:53:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Data-step-inside-IML/m-p/445761#M4075</guid>
      <dc:creator>jan_t_lagen</dc:creator>
      <dc:date>2018-03-15T09:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Data step inside IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Data-step-inside-IML/m-p/445767#M4076</link>
      <description>&lt;P&gt;It sounds like you want to use the SUBMIT / ENDSUBMIT statements to call SAS procedures inside an IML loop.&lt;/P&gt;
&lt;P&gt;I do this all the time. Some resources are:&lt;/P&gt;
&lt;P&gt;1. &lt;A href="https://blogs.sas.com/content/iml/2011/10/24/video-calling-sas-procedures-from-the-sasiml-language.html" target="_self"&gt;Video about calling SAS procedures from SAS/IML&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;2. &lt;A href="http://go.documentation.sas.com/?docsetId=imlug&amp;amp;docsetTarget=imlug_procs_toc.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_self"&gt;SAS/IML documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 10:05:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Data-step-inside-IML/m-p/445767#M4076</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-03-15T10:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: Data step inside IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Data-step-inside-IML/m-p/445797#M4077</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The reason for this is that i need to manipulate the data by joining, inserting new variables and summing in order to reduce the size of the matrix calculations&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This can all be done in IML code. No need for a datastep here.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I also need to do this (in some way) within a loop as I'm sampling data for each iteration.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This can all be done in an IML loop&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 12:07:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Data-step-inside-IML/m-p/445797#M4077</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-03-15T12:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Data step inside IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Data-step-inside-IML/m-p/445800#M4079</link>
      <description>&lt;P&gt;In addition to Paige's comment, I'll point out that some people try perform simulation or bootstrapping by using the technique that you suggest. This is a bad idea because it is not efficient.&amp;nbsp;To read more about how to simulate data in SAS efficiently, see &lt;A href="https://blogs.sas.com/content/iml/2012/07/18/simulation-in-sas-the-slow-way-or-the-by-way.html" target="_self"&gt;"The Slow Way or the BY Way."&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your intention is a simulation or a resampling technique such as the bootstrap,&amp;nbsp;specify what you are trying to accomplish and we can help you implement it efficiently.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you plan on doing several simulation or resampling studies, you might want to search or browse&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/tag/simulation/" target="_blank"&gt;https://blogs.sas.com/content/tag/simulation/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/tag/bootstrap-and-resampling/" target="_blank"&gt;https://blogs.sas.com/content/tag/bootstrap-and-resampling/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The book &lt;A href="https://support.sas.com/en/books/authors/rick-wicklin.html" target="_self"&gt;Simulating Data with SAS&lt;/A&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;also covers these topics in detail.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 12:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Data-step-inside-IML/m-p/445800#M4079</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-03-15T12:20:11Z</dc:date>
    </item>
  </channel>
</rss>

