<?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: Add a label column as a vector or matrix based on condition in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Add-a-label-column-as-a-vector-or-matrix-based-on-condition/m-p/663092#M5167</link>
    <description>Awesome, it works, thanks!&lt;BR /&gt;however, how can I use this info to define another row? like&lt;BR /&gt;create a new vector Q&lt;BR /&gt;Q=p (a numeric variable ) if lab='put';&lt;BR /&gt;Q=c (a numeric variable ) if lab='call';&lt;BR /&gt;Q=(p+c)/2 if lab='mix';&lt;BR /&gt;The vector should be continuous, like&lt;BR /&gt;p c lab Q&lt;BR /&gt;1 2 put 1&lt;BR /&gt;2 3 call 3&lt;BR /&gt;4 5 call 5&lt;BR /&gt;6 7 mix 6.5&lt;BR /&gt;&lt;BR /&gt;Can you help?&lt;BR /&gt;</description>
    <pubDate>Thu, 18 Jun 2020 09:12:49 GMT</pubDate>
    <dc:creator>Sasulee</dc:creator>
    <dc:date>2020-06-18T09:12:49Z</dc:date>
    <item>
      <title>Add a label column as a vector or matrix based on condition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Add-a-label-column-as-a-vector-or-matrix-based-on-condition/m-p/663047#M5165</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have 3 data vectors read in iml which are&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="截屏2020-06-18下午7.24.44.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46317i54A9C1E2C3B87425/image-size/medium?v=v2&amp;amp;px=400" role="button" title="截屏2020-06-18下午7.24.44.png" alt="截屏2020-06-18下午7.24.44.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; I want to mark these data by following discipline:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;label = put where k&amp;lt;k0;&lt;/LI&gt;&lt;LI&gt;label = call where k&amp;gt;k0;&lt;/LI&gt;&lt;LI&gt;label = mix where k=k0.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;How can I do? Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 07:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Add-a-label-column-as-a-vector-or-matrix-based-on-condition/m-p/663047#M5165</guid>
      <dc:creator>Sasulee</dc:creator>
      <dc:date>2020-06-18T07:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Add a label column as a vector or matrix based on condition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Add-a-label-column-as-a-vector-or-matrix-based-on-condition/m-p/663087#M5166</link>
      <description>&lt;P&gt;I think this will work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  lab = choose(k&amp;lt;k0,'put','mix');
  lab = choose(k&amp;gt;k0,'call',lab);
  print k0 k lab;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;however you may need to screen missing values out first if you have them.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 08:57:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Add-a-label-column-as-a-vector-or-matrix-based-on-condition/m-p/663087#M5166</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2020-06-18T08:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Add a label column as a vector or matrix based on condition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Add-a-label-column-as-a-vector-or-matrix-based-on-condition/m-p/663092#M5167</link>
      <description>Awesome, it works, thanks!&lt;BR /&gt;however, how can I use this info to define another row? like&lt;BR /&gt;create a new vector Q&lt;BR /&gt;Q=p (a numeric variable ) if lab='put';&lt;BR /&gt;Q=c (a numeric variable ) if lab='call';&lt;BR /&gt;Q=(p+c)/2 if lab='mix';&lt;BR /&gt;The vector should be continuous, like&lt;BR /&gt;p c lab Q&lt;BR /&gt;1 2 put 1&lt;BR /&gt;2 3 call 3&lt;BR /&gt;4 5 call 5&lt;BR /&gt;6 7 mix 6.5&lt;BR /&gt;&lt;BR /&gt;Can you help?&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Jun 2020 09:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Add-a-label-column-as-a-vector-or-matrix-based-on-condition/m-p/663092#M5167</guid>
      <dc:creator>Sasulee</dc:creator>
      <dc:date>2020-06-18T09:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Add a label column as a vector or matrix based on condition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Add-a-label-column-as-a-vector-or-matrix-based-on-condition/m-p/663093#M5168</link>
      <description>&lt;P&gt;You can use essentially the same syntax to construct Q like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  lab = choose(k&amp;lt;k0,'put','mix');
  lab = choose(k&amp;gt;k0,'call',lab);
  Q = choose(k&amp;lt;k0, p, (p+c)/2);
  Q = choose(k&amp;gt;k0, c, Q);
  print k0 k lab p c Q;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Jun 2020 09:22:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Add-a-label-column-as-a-vector-or-matrix-based-on-condition/m-p/663093#M5168</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2020-06-18T09:22:35Z</dc:date>
    </item>
  </channel>
</rss>

