<?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 Table help in proc iml in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Table-help-in-proc-iml/m-p/793207#M5762</link>
    <description>&lt;P&gt;Dear,&lt;/P&gt;&lt;P&gt;I woud like criate a PESO variable string but I get an Error(1):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I woul like insert an new extra row like:&lt;/P&gt;&lt;P&gt;Carlos M 62 72&amp;nbsp; 75&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;==================================================&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;tClass=TableCreateFromDataSet ("Sashelp", "Class");&lt;BR /&gt;call TablePrint(tClass);&lt;/P&gt;&lt;P&gt;Y=TableGetVarData (tClass, {"Weight" "Height"});&lt;BR /&gt;wt=Y[,1];&lt;BR /&gt;ht=Y[,2];&lt;BR /&gt;BMI=wt/ht##2 * 703;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if (BMI&amp;gt;=18.5) &amp;amp; (BMI&amp;lt;=24.9) then PESO="Normal";&lt;BR /&gt;if (BMI&amp;gt;=25.0) &amp;amp; (BMI&amp;lt;=29.9) then PESO="Sobrepeso";&lt;BR /&gt;if (BMI&amp;gt;=30.0) &amp;amp; (BMI&amp;lt;=39.9) then PESO="Obesidade";&lt;BR /&gt;if (BMI&amp;gt;=40.0) then PESO="Obesidade Grave";&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;call TableAddVar(tClass, "BMI", BMI);&lt;BR /&gt;call TableAddVar(tClass, "PESO", PESO);&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jan 2022 20:01:44 GMT</pubDate>
    <dc:creator>Tadeu1</dc:creator>
    <dc:date>2022-01-28T20:01:44Z</dc:date>
    <item>
      <title>Table help in proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Table-help-in-proc-iml/m-p/793207#M5762</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;&lt;P&gt;I woud like criate a PESO variable string but I get an Error(1):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I woul like insert an new extra row like:&lt;/P&gt;&lt;P&gt;Carlos M 62 72&amp;nbsp; 75&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;==================================================&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;tClass=TableCreateFromDataSet ("Sashelp", "Class");&lt;BR /&gt;call TablePrint(tClass);&lt;/P&gt;&lt;P&gt;Y=TableGetVarData (tClass, {"Weight" "Height"});&lt;BR /&gt;wt=Y[,1];&lt;BR /&gt;ht=Y[,2];&lt;BR /&gt;BMI=wt/ht##2 * 703;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if (BMI&amp;gt;=18.5) &amp;amp; (BMI&amp;lt;=24.9) then PESO="Normal";&lt;BR /&gt;if (BMI&amp;gt;=25.0) &amp;amp; (BMI&amp;lt;=29.9) then PESO="Sobrepeso";&lt;BR /&gt;if (BMI&amp;gt;=30.0) &amp;amp; (BMI&amp;lt;=39.9) then PESO="Obesidade";&lt;BR /&gt;if (BMI&amp;gt;=40.0) then PESO="Obesidade Grave";&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;call TableAddVar(tClass, "BMI", BMI);&lt;BR /&gt;call TableAddVar(tClass, "PESO", PESO);&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 20:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Table-help-in-proc-iml/m-p/793207#M5762</guid>
      <dc:creator>Tadeu1</dc:creator>
      <dc:date>2022-01-28T20:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Table help in proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Table-help-in-proc-iml/m-p/793263#M5763</link>
      <description>&lt;P&gt;Better post it at IML forum. and calling out&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jan 2022 05:45:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Table-help-in-proc-iml/m-p/793263#M5763</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-01-29T05:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Table help in proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Table-help-in-proc-iml/m-p/793279#M5764</link>
      <description>&lt;P&gt;The reason your program is not working is that PESO must be a vector with the same number of elements as the BMI variable. There are two ways to do this:&lt;/P&gt;
&lt;P&gt;1. &lt;A href="https://blogs.sas.com/content/iml/2016/08/08/sas-formats-bin-numerical-variables.html" target="_self"&gt;Define a format and use the format to recode the BMI vector.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;2. &lt;A href="https://blogs.sas.com/content/iml/2013/07/15/cut-pts-and-uneven-bins.html" target="_self"&gt;Use the BIN function in IML to classify each BMI value into a category.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The program below shows the second method:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
tClass=TableCreateFromDataSet ("Sashelp", "Class");
*call TablePrint(tClass);

Y=TableGetVarData (tClass, {"Weight" "Height"});
wt=Y[,1];
ht=Y[,2];
BMI=wt/ht##2 * 703;

/* allocate vector that is the same length as the data */
catIdx = bin(BMI, cutpts);
/* set up cut points */
category = {'Abaixo do Peso' 'Normal' 'Sobrepeso' 'Obesidade' 'Obesidade Grave'};
cutpts = {.M               18.5     25           30          40               .I};
PESO = category[ catIdx ];

call TableAddVar(tClass, "BMI", BMI);
call TableAddVar(tClass, "PESO", PESO);
call TablePrint(tClass);
 

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Jan 2022 11:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Table-help-in-proc-iml/m-p/793279#M5764</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-01-29T11:32:37Z</dc:date>
    </item>
  </channel>
</rss>

