<?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 Where option with use statement in proc iml in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Where-option-with-use-statement-in-proc-iml/m-p/450581#M4109</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to find a number of observations in a given dataset (after sub-setting if where condition is provided) using proc iml.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The where option present in "use, read and other" statements in proc iml does not allow to use "Mnemomic" operators (for ex: eq, ne, ge and so on).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to use the "where" as a dataset option as below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one;&lt;BR /&gt;input v2;&lt;BR /&gt;cards;&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;45&lt;BR /&gt;56&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;use one (where = (v2 le 40)) nobs a var _all_;&lt;BR /&gt;print a;&lt;BR /&gt;close one;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting the value of a as "6".&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to sub-set the dataset (where statement with "Mnemomic" operators? and get the number of observations in the resulting dataset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Venkat.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Apr 2018 12:12:32 GMT</pubDate>
    <dc:creator>Venkibhu1</dc:creator>
    <dc:date>2018-04-03T12:12:32Z</dc:date>
    <item>
      <title>Where option with use statement in proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Where-option-with-use-statement-in-proc-iml/m-p/450581#M4109</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to find a number of observations in a given dataset (after sub-setting if where condition is provided) using proc iml.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The where option present in "use, read and other" statements in proc iml does not allow to use "Mnemomic" operators (for ex: eq, ne, ge and so on).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to use the "where" as a dataset option as below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one;&lt;BR /&gt;input v2;&lt;BR /&gt;cards;&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;45&lt;BR /&gt;56&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;use one (where = (v2 le 40)) nobs a var _all_;&lt;BR /&gt;print a;&lt;BR /&gt;close one;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting the value of a as "6".&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to sub-set the dataset (where statement with "Mnemomic" operators? and get the number of observations in the resulting dataset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Venkat.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 12:12:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Where-option-with-use-statement-in-proc-iml/m-p/450581#M4109</guid>
      <dc:creator>Venkibhu1</dc:creator>
      <dc:date>2018-04-03T12:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Where option with use statement in proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Where-option-with-use-statement-in-proc-iml/m-p/450587#M4110</link>
      <description>&lt;P&gt;The USE statement does not read data. It merely opens the data set and examines the characteristics (type, length,...) of the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you apply WHERE clause to filter the data, the only way to know how many observations pass through the filter is to actually read the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
use one (where = (v2 le 40));
read all var {"v2"};
close one;

n = nrow(v2);
print n;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Apr 2018 12:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Where-option-with-use-statement-in-proc-iml/m-p/450587#M4110</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-04-03T12:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Where option with use statement in proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Where-option-with-use-statement-in-proc-iml/m-p/450592#M4111</link>
      <description>&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here, variable name "V2" is hard coded. Is there any way to generalize this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If, the dataset is huge then read statement is taking much time to convert the dataset into a matrix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to get a name of any of the variable from the input dataset and use it in both "read" and "nrow"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Venkat.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 12:29:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Where-option-with-use-statement-in-proc-iml/m-p/450592#M4111</guid>
      <dc:creator>Venkibhu1</dc:creator>
      <dc:date>2018-04-03T12:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Where option with use statement in proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Where-option-with-use-statement-in-proc-iml/m-p/450596#M4112</link>
      <description>&lt;P&gt;use &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/68150/HTML/default/viewer.htm#imlug_langref_sect079.htm" target="_self"&gt;the CONTENTS function&lt;/A&gt;&amp;nbsp;to get the names of variables. Then read any variable, such as the first&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
use sashelp.class (where = (age le 15));
varNames = contents();
print varNames;

read all var (varNames[1]) into X;
close one;

n = nrow(X);
print n;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Apr 2018 12:41:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Where-option-with-use-statement-in-proc-iml/m-p/450596#M4112</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-04-03T12:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Where option with use statement in proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Where-option-with-use-statement-in-proc-iml/m-p/450603#M4113</link>
      <description>&lt;P&gt;Thank you very much Rick...Its working...&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 12:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Where-option-with-use-statement-in-proc-iml/m-p/450603#M4113</guid>
      <dc:creator>Venkibhu1</dc:creator>
      <dc:date>2018-04-03T12:57:32Z</dc:date>
    </item>
  </channel>
</rss>

