<?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: lists in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/lists/m-p/280131#M2879</link>
    <description>&lt;P&gt;Although R and SAS/IML share a lot of functionality and serve the same computational audience, SAS/IML does not have the same variety of data structures as R does. In particular, SAS/IML does not support lists natively, although there are various work-arounds.&lt;/P&gt;
&lt;P&gt;The trick that I use most often is to &lt;A href="http://blogs.sas.com/content/iml/2015/02/09/array-of-matrices.html" target="_self"&gt;define an array of matrices.&lt;/A&gt;&amp;nbsp; Another trick is to maintain three separate arrays, one for bets, one for shoes, and one for cards.&amp;nbsp; The i_th row of each matrix refers to the same hand, so are&amp;nbsp;related.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, to encode&amp;nbsp;N poker hands and bets, you could use&lt;/P&gt;
&lt;P&gt;N = 3;&lt;/P&gt;
&lt;P&gt;bets = j(N, 1, .);&amp;nbsp; /* i_th row is bet for i_th hand (or i_th player) */&lt;/P&gt;
&lt;P&gt;cards = j(N, 5, .);&lt;/P&gt;
&lt;P&gt;do i = 1 to N;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; /* simulate bets and deals */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; cards[i,] = deal_the_hand(...args...);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; bets[i] = determine_the_bet(...args...);&amp;nbsp;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For dealing, you might want to &lt;A href="http://blogs.sas.com/content/iml/2014/02/03/sample-without-replacement.html" target="_self"&gt;look at the SAMPLE function.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One last thought: SAS/IML has functions (sometimes called modules). You can define functions and&amp;nbsp;&lt;A href="http://blogs.sas.com/content/iml/2014/03/19/define-functions-with-optional-parameters-in-sasiml.html" target="_self"&gt;supply default parameter values for optional arguments.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like you might be a novice programmer in SAS/IML. If so, you might want to read &lt;A href="http://blogs.sas.com/content/iml/2014/08/11/ten-tips-for-learning-sasiml.html" target="_self"&gt;"Ten tips for learning the SAS/IML language."&lt;/A&gt; A key to being a&amp;nbsp;successful programmer in any language is to learn how to think in that language.&amp;nbsp;Sometimes new programmers try to duplicate paradigms that work well in another language, but do not extend to the new language.&amp;nbsp; I remember being proud of a LISP program that I wrote in the 1980s.&amp;nbsp; My colleague commented that "this is the best FORTRAN program translated into LISP" that he had ever seen.&amp;nbsp; He then showed me how to think in LISP.&lt;/P&gt;</description>
    <pubDate>Sat, 25 Jun 2016 10:44:43 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2016-06-25T10:44:43Z</dc:date>
    <item>
      <title>lists</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/lists/m-p/280099#M2877</link>
      <description>&lt;P&gt;Is there a way to create a list of elements in SAS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to replicate the R code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;new_hand = function(shoe, cards = shoe(2), bet = 1)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;list(bet = bet, shoe = shoe, cards = cards)&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shoe is already a previous created function (or in SAS, macro). I am trying to create a new macro called new_hand that is similar to this R function.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2016 23:17:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/lists/m-p/280099#M2877</guid>
      <dc:creator>ejohnson96</dc:creator>
      <dc:date>2016-06-24T23:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: lists</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/lists/m-p/280101#M2878</link>
      <description>&lt;P&gt;It's probably better to use SAS functionality.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This looks like a recode/lookup function? If so, I'd use a format.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2016 00:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/lists/m-p/280101#M2878</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-25T00:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: lists</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/lists/m-p/280131#M2879</link>
      <description>&lt;P&gt;Although R and SAS/IML share a lot of functionality and serve the same computational audience, SAS/IML does not have the same variety of data structures as R does. In particular, SAS/IML does not support lists natively, although there are various work-arounds.&lt;/P&gt;
&lt;P&gt;The trick that I use most often is to &lt;A href="http://blogs.sas.com/content/iml/2015/02/09/array-of-matrices.html" target="_self"&gt;define an array of matrices.&lt;/A&gt;&amp;nbsp; Another trick is to maintain three separate arrays, one for bets, one for shoes, and one for cards.&amp;nbsp; The i_th row of each matrix refers to the same hand, so are&amp;nbsp;related.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, to encode&amp;nbsp;N poker hands and bets, you could use&lt;/P&gt;
&lt;P&gt;N = 3;&lt;/P&gt;
&lt;P&gt;bets = j(N, 1, .);&amp;nbsp; /* i_th row is bet for i_th hand (or i_th player) */&lt;/P&gt;
&lt;P&gt;cards = j(N, 5, .);&lt;/P&gt;
&lt;P&gt;do i = 1 to N;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; /* simulate bets and deals */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; cards[i,] = deal_the_hand(...args...);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; bets[i] = determine_the_bet(...args...);&amp;nbsp;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For dealing, you might want to &lt;A href="http://blogs.sas.com/content/iml/2014/02/03/sample-without-replacement.html" target="_self"&gt;look at the SAMPLE function.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One last thought: SAS/IML has functions (sometimes called modules). You can define functions and&amp;nbsp;&lt;A href="http://blogs.sas.com/content/iml/2014/03/19/define-functions-with-optional-parameters-in-sasiml.html" target="_self"&gt;supply default parameter values for optional arguments.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like you might be a novice programmer in SAS/IML. If so, you might want to read &lt;A href="http://blogs.sas.com/content/iml/2014/08/11/ten-tips-for-learning-sasiml.html" target="_self"&gt;"Ten tips for learning the SAS/IML language."&lt;/A&gt; A key to being a&amp;nbsp;successful programmer in any language is to learn how to think in that language.&amp;nbsp;Sometimes new programmers try to duplicate paradigms that work well in another language, but do not extend to the new language.&amp;nbsp; I remember being proud of a LISP program that I wrote in the 1980s.&amp;nbsp; My colleague commented that "this is the best FORTRAN program translated into LISP" that he had ever seen.&amp;nbsp; He then showed me how to think in LISP.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2016 10:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/lists/m-p/280131#M2879</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-06-25T10:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: lists</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/lists/m-p/280183#M2880</link>
      <description>&lt;PRE&gt;
Then show us your data,output and the function you want to achieve .

In IML ,don't have the data structure like HashMap, List , TreeList ......  as other language Java,C++ ...

&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Jun 2016 05:11:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/lists/m-p/280183#M2880</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-26T05:11:49Z</dc:date>
    </item>
  </channel>
</rss>

