<?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 How to transmit numberic value in program? in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458346#M4159</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
b={1 2,3 4,5 6};
k=nrow(b);
quit;

%macro try();

%do k=1 %to k;
proc iml;
t=exp(k);
print t;
quit;
%end;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hey Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example. I want to transmit the number of rows of the matrix b to the interation steps in the macro. How can I do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
    <pubDate>Sat, 28 Apr 2018 12:34:57 GMT</pubDate>
    <dc:creator>supmilk</dc:creator>
    <dc:date>2018-04-28T12:34:57Z</dc:date>
    <item>
      <title>How to transmit numberic value in program?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458346#M4159</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
b={1 2,3 4,5 6};
k=nrow(b);
quit;

%macro try();

%do k=1 %to k;
proc iml;
t=exp(k);
print t;
quit;
%end;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hey Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example. I want to transmit the number of rows of the matrix b to the interation steps in the macro. How can I do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Sat, 28 Apr 2018 12:34:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458346#M4159</guid>
      <dc:creator>supmilk</dc:creator>
      <dc:date>2018-04-28T12:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to transmit numberic value in program?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458347#M4160</link>
      <description>&lt;P&gt;Instead of doing this via a macro, you could do all the looping inside of PROC IML, in which case the problem goes away.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Apr 2018 13:37:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458347#M4160</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-04-28T13:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to transmit numberic value in program?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458350#M4161</link>
      <description>&lt;P&gt;Yes, i agree with you, but here is just an example. What I want to know is how to transmit the value but not just this example.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Apr 2018 13:48:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458350#M4161</guid>
      <dc:creator>supmilk</dc:creator>
      <dc:date>2018-04-28T13:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to transmit numberic value in program?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458363#M4162</link>
      <description>&lt;P&gt;I will stick with my answer above. A macro isn't needed here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your example is really more complicated than this, then convince me that a macro is needed and that you can't do this via inside of one large PROC IML step. I cannot conceive of a situation where you need to run PROC IML to get a value, transfer that value to a macro variable, and then use the value in the macro variable in another run of PROC IML, when the very simple alternative is to calculate the value in PROC IML and then continue to use that value in IML as you do more calculations in IML.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Apr 2018 15:04:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458363#M4162</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-04-28T15:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to transmit numberic value in program?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458374#M4163</link>
      <description>&lt;P&gt;No idea how you can create macro variables from IML.&amp;nbsp; Does it support the CALL SYMPUTX() function?&lt;/P&gt;
&lt;P&gt;You could have IML store the value into&amp;nbsp;a dataset and then use a data step to write the macro variable using CALL SYMPUTX().&lt;/P&gt;</description>
      <pubDate>Sat, 28 Apr 2018 17:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458374#M4163</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-28T17:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to transmit numberic value in program?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458591#M4164</link>
      <description>&lt;P&gt;Why not post it at IML forum since it is about IML question ?&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;is there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
b={1 2,3 4,5 6};
_k=nrow(b);
do k=1 to _k;
t=exp(k);
print t;
end;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Apr 2018 11:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458591#M4164</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-04-30T11:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to transmit numberic value in program?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458605#M4165</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;indicates, most experienced SAS/IML programmers avoid macro loops because they are inefficient and unnecessary in a language that has its own looping structures.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You&amp;nbsp;indicate that your "real" use case is more complicated than&amp;nbsp;this example, If you tell us what you are trying to accomplish, we can probably advise a robust and efficient way to accomplish your&amp;nbsp;goal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you wish to pursue this macro method, &lt;A href="https://blogs.sas.com/content/iml/2011/10/17/does-symput-work-in-iml.html" target="_self"&gt;you can call the SYMPUTX subroutine in IML.&lt;/A&gt;&amp;nbsp;Be sure to also read the article &lt;A href="https://blogs.sas.com/content/iml/2013/06/19/macros-and-loops.html" target="_blank"&gt;"Macros and loops in the SAS/IML language"&lt;/A&gt;, which&amp;nbsp;discusses an example that shows how to understand the macro pre-processor in an interactive&amp;nbsp;procedure such as PROC IML.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 12:06:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458605#M4165</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-04-30T12:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to transmit numberic value in program?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458626#M4166</link>
      <description>&lt;P&gt;My goal is to try to take some computed result as a parameter of macro step or data step. We can forget the loops in my example. Another example: I want to pick up the value of c, and then set it as a parameter of macro test.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
a=1;
b=2;
c=a+b;
quit;

macro test(c);
********
mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Apr 2018 13:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458626#M4166</guid>
      <dc:creator>supmilk</dc:creator>
      <dc:date>2018-04-30T13:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to transmit numberic value in program?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458730#M4167</link>
      <description>&lt;P&gt;OK. Then use SYMPUTX, as suggested:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
a=1;  b=2;  c=a+b;
call symputx("c", c);
quit;

%put &amp;amp;=c;

%macro test(val);
  data _null_;
     sq = &amp;amp;val.**2;
     put sq=;
  run; 
%mend;

%test(&amp;amp;c);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 16:19:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458730#M4167</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-04-30T16:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to transmit numberic value in program?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458779#M4168</link>
      <description>&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 18:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-transmit-numberic-value-in-program/m-p/458779#M4168</guid>
      <dc:creator>supmilk</dc:creator>
      <dc:date>2018-04-30T18:13:32Z</dc:date>
    </item>
  </channel>
</rss>

