<?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: Extract abservation from commun variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883443#M349054</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    category = n(bhb,mun,lac);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 04 Jul 2023 12:52:43 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-07-04T12:52:43Z</dc:date>
    <item>
      <title>Extract abservation from commun variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883343#M349007</link>
      <description>&lt;P&gt;Hi every one,&lt;/P&gt;
&lt;P&gt;below is type of data i am working on, and i need a little help , in fact i need to count or extract the animals those have only observation recorded&amp;nbsp; from BHb Var. or recorded from two Var. BHB and MUn and also , three Var. BHB, MUN and Lac , same thing if an animal have only one observation fr only the 3rd var (LAc.&lt;/P&gt;
&lt;P&gt;Thank guys , i appriciate your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="256"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;Animal&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64"&gt;BHB&lt;/TD&gt;
&lt;TD width="64"&gt;MUN&lt;/TD&gt;
&lt;TD width="64"&gt;Lac&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;T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gt;10&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Mon, 03 Jul 2023 18:37:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883343#M349007</guid>
      <dc:creator>Ameurgen</dc:creator>
      <dc:date>2023-07-03T18:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extract abservation from commun variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883355#M349011</link>
      <description>&lt;P&gt;Please show us the desired output from this example data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2023 21:24:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883355#M349011</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-07-03T21:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Extract abservation from commun variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883440#M349052</link>
      <description>&lt;P&gt;Hi Mr.&amp;nbsp;&lt;SPAN&gt;Paige Miller&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;i need to identify each animal with each test are BHB , MUN or Lac, for example, following the type of color, animal 3 , 4 , 6 and 8&amp;nbsp; have the complete 3 tests. but 2 and 10 are tested only by BHB and lac.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, i dont know if you have now an idea about my&amp;nbsp;my desirable output data.&lt;/P&gt;
&lt;P&gt;Thank you so much for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AMEUR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ameurgen_0-1688473302169.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/85549iDBD92A4C946A6290/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ameurgen_0-1688473302169.png" alt="Ameurgen_0-1688473302169.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 12:26:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883440#M349052</guid>
      <dc:creator>Ameurgen</dc:creator>
      <dc:date>2023-07-04T12:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extract abservation from commun variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883443#M349054</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    category = n(bhb,mun,lac);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jul 2023 12:52:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883443#M349054</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-07-04T12:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extract abservation from commun variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883448#M349057</link>
      <description>&lt;P&gt;Hi ,&amp;nbsp;&lt;SPAN&gt;Paige&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Miller , thank you for your reply.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Sorry its not working this give the whole number of tests without specify which test , for example using the table mentionned above, those animals have only two different test type . the code give me number 2 but i cant know which test is BHB with Lac or BHB with MUN.&lt;/P&gt;
&lt;P&gt;Thank you so muhc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AMEUR&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 13:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883448#M349057</guid>
      <dc:creator>Ameurgen</dc:creator>
      <dc:date>2023-07-04T13:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Extract abservation from commun variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883450#M349058</link>
      <description>&lt;P&gt;Colors are hard to program.&amp;nbsp; But numbers are easy.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input Animal BHB MUN Lac;
cards;
1  1 4 . 
2  1 . 5
3  1 4 5
4  1 4 5
5  . 4 .
6  1 4 5
7  . . 5
8  1 4 5
9  . 4 5
10 1 . 5
;

data want;
  set have;
  group = 4*missing(BHB)+2*missing(MUN)+missing(Lac);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;Obs    Animal    BHB    MUN    Lac    group

  1       1       1      4      .       1
  2       2       1      .      5       2
  3       3       1      4      5       0
  4       4       1      4      5       0
  5       5       .      4      .       5
  6       6       1      4      5       0
  7       7       .      .      5       6
  8       8       1      4      5       0
  9       9       .      4      5       4
 10      10       1      .      5       2
&lt;/PRE&gt;
&lt;P&gt;Or use the BINARY format to see how the numbers 0 to 7 are formed from the three bits.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print;
  format group binary3.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    Animal    BHB    MUN    Lac    group

  1       1       1      4      .      001
  2       2       1      .      5      010
  3       3       1      4      5      000
  4       4       1      4      5      000
  5       5       .      4      .      101
  6       6       1      4      5      000
  7       7       .      .      5      110
  8       8       1      4      5      000
  9       9       .      4      5      100
 10      10       1      .      5      010

&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jul 2023 14:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883450#M349058</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-07-04T14:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extract abservation from commun variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883455#M349061</link>
      <description>&lt;P&gt;Its worked , perfectly , thank you TOM.&lt;/P&gt;
&lt;P&gt;AMEUR&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 14:51:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-abservation-from-commun-variables/m-p/883455#M349061</guid>
      <dc:creator>Ameurgen</dc:creator>
      <dc:date>2023-07-04T14:51:49Z</dc:date>
    </item>
  </channel>
</rss>

