<?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: Running a macro loop inside proc IML SAS 9.4 in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-Running-a-macro-loop-inside-proc-IML-SAS-9-4/m-p/563447#M4686</link>
    <description>&lt;P&gt;I am trying to create several data sets say N=100 samples each of size n=20 of correlated data variables using proc IML with your suggestion and it does not work for me could you or any one help. Check&amp;nbsp; code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc iml;&lt;BR /&gt;/** specify the mean and covariance of the population **/&lt;BR /&gt;Mean = {0, 0};&lt;BR /&gt;Cov = {1 -0.35,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-0.35 1};&lt;BR /&gt;&lt;BR /&gt;N = 20; /* size of data */&lt;BR /&gt;do mm=1 to 100;&lt;BR /&gt;dsname="user.randEff" + strip(char(mm));&lt;BR /&gt;call randseed(44444);&amp;nbsp;&amp;nbsp;&lt;BR /&gt;X = RandNormal(N, Mean, Cov);&lt;BR /&gt;create dsname FROM X;&lt;BR /&gt;append from X;&lt;BR /&gt;close dsname;;&lt;/P&gt;&lt;P&gt;end;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I expect 100 data sets with names&amp;nbsp; tagged as : user.randEff1, user.randEff2, ..., user.randEff100,&lt;/P&gt;&lt;P&gt;But it creates one data set user.dsname, it loops through the code alright but it looks like data is replaced after&amp;nbsp;&lt;/P&gt;&lt;P&gt;every loop and thus only one dataset is created.&lt;/P&gt;&lt;P&gt;user is the libref&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jun 2019 06:18:32 GMT</pubDate>
    <dc:creator>sbampah</dc:creator>
    <dc:date>2019-06-04T06:18:32Z</dc:date>
    <item>
      <title>Re: Running a macro loop inside proc IML SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-Running-a-macro-loop-inside-proc-IML-SAS-9-4/m-p/563447#M4686</link>
      <description>&lt;P&gt;I am trying to create several data sets say N=100 samples each of size n=20 of correlated data variables using proc IML with your suggestion and it does not work for me could you or any one help. Check&amp;nbsp; code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc iml;&lt;BR /&gt;/** specify the mean and covariance of the population **/&lt;BR /&gt;Mean = {0, 0};&lt;BR /&gt;Cov = {1 -0.35,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-0.35 1};&lt;BR /&gt;&lt;BR /&gt;N = 20; /* size of data */&lt;BR /&gt;do mm=1 to 100;&lt;BR /&gt;dsname="user.randEff" + strip(char(mm));&lt;BR /&gt;call randseed(44444);&amp;nbsp;&amp;nbsp;&lt;BR /&gt;X = RandNormal(N, Mean, Cov);&lt;BR /&gt;create dsname FROM X;&lt;BR /&gt;append from X;&lt;BR /&gt;close dsname;;&lt;/P&gt;&lt;P&gt;end;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I expect 100 data sets with names&amp;nbsp; tagged as : user.randEff1, user.randEff2, ..., user.randEff100,&lt;/P&gt;&lt;P&gt;But it creates one data set user.dsname, it loops through the code alright but it looks like data is replaced after&amp;nbsp;&lt;/P&gt;&lt;P&gt;every loop and thus only one dataset is created.&lt;/P&gt;&lt;P&gt;user is the libref&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 06:18:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-Running-a-macro-loop-inside-proc-IML-SAS-9-4/m-p/563447#M4686</guid>
      <dc:creator>sbampah</dc:creator>
      <dc:date>2019-06-04T06:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Running a macro loop inside proc IML SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-Running-a-macro-loop-inside-proc-IML-SAS-9-4/m-p/563479#M4688</link>
      <description>&lt;P&gt;&lt;SPAN&gt;See the article, &lt;A href="https://blogs.sas.com/content/iml/2013/07/29/read-data-sets-array-names.html" target="_self"&gt;"Read data sets that are specified by an array of names,"&lt;/A&gt; which shows how to&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Insert parentheses to get IMl to read the contents of the character variable:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;create (dsname) FROM X;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, you almost surely DO NOT want to do what you are proposing. Instead, create one data set and use an indicator variable (called SampleID) to indicate which sample is being written. You can then use BY-group processing to analyze the data. For an overview of the BY-group technique, 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;"Simulation in SAS: The slow way or the BY way."&amp;nbsp;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can study the simulation code in &lt;A href="https://blogs.sas.com/content/iml/2013/04/10/generate-multiple-mvn-samples.html" target="_self"&gt;"How to generate multiple samples from the multivariate normal distribution in SAS".&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can also use the &lt;A href="https://blogs.sas.com/content/iml/2019/05/13/write-results-inside-iml-loop.html" target="_self"&gt;"Write to a SAS data set from inside a SAS/IML loop."&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 09:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Re-Running-a-macro-loop-inside-proc-IML-SAS-9-4/m-p/563479#M4688</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-06-04T09:58:52Z</dc:date>
    </item>
  </channel>
</rss>

