<?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: Calling a macro inside proc iml. I want dataset to be updated in each loop. in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521034#M4483</link>
    <description>&lt;P&gt;I am still not able to get what I am looking for. I tried this code.&lt;/P&gt;&lt;PRE&gt;%macro hello(X);
use &amp;amp;dataset; read all var{&amp;amp;X} into A;
m=mean(A);
print m;
%mend hello;


proc iml;&lt;BR /&gt;z=j(5,1,0);&lt;BR /&gt;do i = 1 to 5;&lt;BR /&gt; X=randnormal(10,0,1);&lt;BR /&gt; varNames={X1};&lt;BR /&gt; print X[colname=varNames];&lt;BR /&gt; create newdata from X[colname=varNames];&lt;BR /&gt; append from X;&lt;BR /&gt; close;&lt;BR /&gt; %let dataset=newdata;&lt;BR /&gt; %hello(X1);&lt;BR /&gt; z[i]=m[1];&lt;BR /&gt;end;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;Following is the error message:&lt;/PRE&gt;&lt;DIV class="sasNote"&gt;NOTE: Module RANDNORMAL loaded from the storage SASHELP.IMLMLIB.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Module ROWVEC loaded from the storage SASHELP.IMLMLIB.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Closing WORK.NEWDATA&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.NEWDATA has 10 observations and 1 variables.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: The data set WORK.NEWDATA is in use, cannot be created.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;statement : CREATE at line 76 column 2&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Exiting IML.&lt;/DIV&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Dec 2018 23:27:08 GMT</pubDate>
    <dc:creator>themanoj20080</dc:creator>
    <dc:date>2018-12-12T23:27:08Z</dc:date>
    <item>
      <title>Calling a macro inside proc iml. I want dataset to be updated in each loop.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521014#M4479</link>
      <description>&lt;PRE&gt;Here is the example. I have a macro and proc iml. In the PROC IML, after the loop ends I want five different means but I am not getting that.
%macro hello(X);
use &amp;amp;dataset; read all var{&amp;amp;X} into A;
m=mean(A);
print m;
%mend hello;

proc iml;
do i = 1 to 5;
X=randnormal(10,0,1);
firstcol=X[,1];
create newdata var{firstcol};
append;
close;
%let dataset=newdata;
%hello(firstcol);
call delete(dataset);
end;
quit;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Dec 2018 21:32:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521014#M4479</guid>
      <dc:creator>themanoj20080</dc:creator>
      <dc:date>2018-12-12T21:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro inside proc iml. I want dataset to be updated in each loop.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521016#M4480</link>
      <description>Any particular reason you're using IML here? it seems like it would be drastically easier to just use PROC MEANS.</description>
      <pubDate>Wed, 12 Dec 2018 21:35:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521016#M4480</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-12T21:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro inside proc iml. I want dataset to be updated in each loop.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521019#M4481</link>
      <description>&lt;P&gt;This was the example that I created to ask question here. What I have is more complicated. But the idea is same. What I want is in each loop when I call the macro I should be getting different result.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 21:38:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521019#M4481</guid>
      <dc:creator>themanoj20080</dc:creator>
      <dc:date>2018-12-12T21:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro inside proc iml. I want dataset to be updated in each loop.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521030#M4482</link>
      <description>&lt;P&gt;The call&amp;nbsp;&lt;/P&gt;
&lt;P&gt;X=randnormal(10,0,1);&lt;/P&gt;
&lt;P&gt;creates a vector that has 10 obs and 1 var.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, every time you run the CREATE statement, it overwrites the previous data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want a data set that has 5 columns, then put the&amp;nbsp;variables into a matrix that has 5 cols and &lt;A href="https://blogs.sas.com/content/iml/2011/04/18/writing-data-from-a-matrix-to-a-sas-data-set.html" target="_self"&gt;write the matrix to a data set&lt;/A&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
X=randnormal(10,{0 0 0 0 0},I(5));
varNames = {X1 X2 X3 X4 X5};
print X[colname=varNames];
create newdata from X[colname=varNames];
append from X;
close;
quit;

proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Dec 2018 22:59:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521030#M4482</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-12-12T22:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro inside proc iml. I want dataset to be updated in each loop.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521034#M4483</link>
      <description>&lt;P&gt;I am still not able to get what I am looking for. I tried this code.&lt;/P&gt;&lt;PRE&gt;%macro hello(X);
use &amp;amp;dataset; read all var{&amp;amp;X} into A;
m=mean(A);
print m;
%mend hello;


proc iml;&lt;BR /&gt;z=j(5,1,0);&lt;BR /&gt;do i = 1 to 5;&lt;BR /&gt; X=randnormal(10,0,1);&lt;BR /&gt; varNames={X1};&lt;BR /&gt; print X[colname=varNames];&lt;BR /&gt; create newdata from X[colname=varNames];&lt;BR /&gt; append from X;&lt;BR /&gt; close;&lt;BR /&gt; %let dataset=newdata;&lt;BR /&gt; %hello(X1);&lt;BR /&gt; z[i]=m[1];&lt;BR /&gt;end;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;Following is the error message:&lt;/PRE&gt;&lt;DIV class="sasNote"&gt;NOTE: Module RANDNORMAL loaded from the storage SASHELP.IMLMLIB.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Module ROWVEC loaded from the storage SASHELP.IMLMLIB.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Closing WORK.NEWDATA&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.NEWDATA has 10 observations and 1 variables.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: The data set WORK.NEWDATA is in use, cannot be created.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;statement : CREATE at line 76 column 2&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Exiting IML.&lt;/DIV&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Dec 2018 23:27:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521034#M4483</guid>
      <dc:creator>themanoj20080</dc:creator>
      <dc:date>2018-12-12T23:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro inside proc iml. I want dataset to be updated in each loop.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521040#M4484</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/250512"&gt;@themanoj20080&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am still not able to get what I am looking for. I tried this code.&lt;/P&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then perhaps it is time to show what some&amp;nbsp;data similar to what&amp;nbsp;you are actually starting with and what the result for that starting data should be. BOTH, begin and end.&lt;/P&gt;
&lt;P&gt;Showing code that doesn't work does not get us a lot closer to an actual solution. Showing the desired solution for actual data allows better understanding of the actual issue.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 00:10:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521040#M4484</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-12-13T00:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro inside proc iml. I want dataset to be updated in each loop.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521104#M4485</link>
      <description>&lt;P&gt;Your second posting contains the same program as your first post. You did not incorporate my suggestion.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 10:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521104#M4485</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-12-13T10:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro inside proc iml. I want dataset to be updated in each loop.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521132#M4486</link>
      <description>&lt;P&gt;Actually I got it to work. I just had to put "call delete(my data)" at the end. Thank you for your suggestion.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 13:34:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521132#M4486</guid>
      <dc:creator>themanoj20080</dc:creator>
      <dc:date>2018-12-13T13:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a macro inside proc iml. I want dataset to be updated in each loop.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521133#M4487</link>
      <description>&lt;P&gt;Need to add "call delete(mydata)" at the end. And it works.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 13:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Calling-a-macro-inside-proc-iml-I-want-dataset-to-be-updated-in/m-p/521133#M4487</guid>
      <dc:creator>themanoj20080</dc:creator>
      <dc:date>2018-12-13T13:34:59Z</dc:date>
    </item>
  </channel>
</rss>

