<?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 Create a variable with counts from existing categorical values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-variable-with-counts-from-existing-categorical-values/m-p/748492#M235076</link>
    <description>&lt;P&gt;Greetings,&lt;/P&gt;
&lt;P&gt;I have a data with 5 columns for each partner, test results for each partner (POS1-POS5 if positive, NEG1-5 for negative results). Te last set of columns is age group of that partner. Snap shot of my data below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 960pt;" border="0" width="1280" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="64" height="19" class="xl67" style="height: 14.4pt; width: 48pt;"&gt;Partner1&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Partner2&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Partner3&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Partner4&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Partner5&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;POS1&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;POS2&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;POS3&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;POS4&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;POS5&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;NEG1&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;NEG2&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;NEG3&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;NEG4&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;NEG5&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Age1&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Age2&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Age3&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Age4&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Age5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" align="right" class="xl65" style="height: 14.4pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;16-20&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;21-25&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" align="right" class="xl65" style="height: 14.4pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;16-20&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;21-25&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" align="right" class="xl65" style="height: 14.4pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;21-25&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" align="right" class="xl65" style="height: 14.4pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;16-20&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;21-25&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to create a count of how POS and Neg by age group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g.If there is&lt;/P&gt;
&lt;P&gt;1 partner with age A1 then #A1=1, A2=0, A3=0, A4=0&lt;/P&gt;
&lt;P&gt;2 partners with A1 and A3 then #A1=2, A2=0, A3=1, A4=0&lt;/P&gt;
&lt;P&gt;3 partners with A1, A3, A4 then #A1=3, A2=0, A3=2, A4=1&lt;/P&gt;
&lt;P&gt;4 partners with 2 in A1, 2 in A4 then #A1=5, A2=0, A3=2, A4=3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Snapshot of my final output:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="64" height="19" class="xl65" style="height: 14.4pt; width: 48pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;POS&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;NEG&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;Age1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;Age2&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;Age3&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;Age4&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used SUM (of POS1-POS5) and SUM (of NEG1-Neg5) to get no. of positives and negatives. But not sure how to proceed with POS and NEGs by age group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;THanks in Advance.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Jun 2021 19:17:42 GMT</pubDate>
    <dc:creator>rsva</dc:creator>
    <dc:date>2021-06-16T19:17:42Z</dc:date>
    <item>
      <title>Create a variable with counts from existing categorical values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-variable-with-counts-from-existing-categorical-values/m-p/748492#M235076</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;
&lt;P&gt;I have a data with 5 columns for each partner, test results for each partner (POS1-POS5 if positive, NEG1-5 for negative results). Te last set of columns is age group of that partner. Snap shot of my data below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 960pt;" border="0" width="1280" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="64" height="19" class="xl67" style="height: 14.4pt; width: 48pt;"&gt;Partner1&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Partner2&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Partner3&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Partner4&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Partner5&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;POS1&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;POS2&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;POS3&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;POS4&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;POS5&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;NEG1&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;NEG2&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;NEG3&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;NEG4&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;NEG5&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Age1&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Age2&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Age3&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Age4&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;Age5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" align="right" class="xl65" style="height: 14.4pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;16-20&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;21-25&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" align="right" class="xl65" style="height: 14.4pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;16-20&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;21-25&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" align="right" class="xl65" style="height: 14.4pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;21-25&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" align="right" class="xl65" style="height: 14.4pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10-15&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;16-20&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;21-25&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;50+&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to create a count of how POS and Neg by age group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g.If there is&lt;/P&gt;
&lt;P&gt;1 partner with age A1 then #A1=1, A2=0, A3=0, A4=0&lt;/P&gt;
&lt;P&gt;2 partners with A1 and A3 then #A1=2, A2=0, A3=1, A4=0&lt;/P&gt;
&lt;P&gt;3 partners with A1, A3, A4 then #A1=3, A2=0, A3=2, A4=1&lt;/P&gt;
&lt;P&gt;4 partners with 2 in A1, 2 in A4 then #A1=5, A2=0, A3=2, A4=3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Snapshot of my final output:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="64" height="19" class="xl65" style="height: 14.4pt; width: 48pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;POS&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;NEG&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;Age1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;Age2&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;Age3&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;Age4&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used SUM (of POS1-POS5) and SUM (of NEG1-Neg5) to get no. of positives and negatives. But not sure how to proceed with POS and NEGs by age group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;THanks in Advance.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 19:17:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-variable-with-counts-from-existing-categorical-values/m-p/748492#M235076</guid>
      <dc:creator>rsva</dc:creator>
      <dc:date>2021-06-16T19:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create a variable with counts from existing categorical values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-variable-with-counts-from-existing-categorical-values/m-p/748704#M235160</link>
      <description>&lt;P&gt;Just how does this differ from your other extremely similar question in&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Get-counts-by-groups-across-columns/m-p/748548" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Get-counts-by-groups-across-columns/m-p/748548&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And have you read any of the responses to that one and asked questions if you didn't understand.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 14:49:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-variable-with-counts-from-existing-categorical-values/m-p/748704#M235160</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-17T14:49:46Z</dc:date>
    </item>
  </channel>
</rss>

