<?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: How to find the count of specific variable within a dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715133#M220864</link>
    <description>&lt;P&gt;I have can produce this using 1 Data step, two PROC TRANSPOSEs, and a PROC TABULATE.&amp;nbsp; This seems too hard.&amp;nbsp; Why is your synthetic data structured this way?&amp;nbsp; Can you choose another structure?&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jan 2021 21:59:15 GMT</pubDate>
    <dc:creator>PhilC</dc:creator>
    <dc:date>2021-01-28T21:59:15Z</dc:date>
    <item>
      <title>How to find the count of specific variable within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/714843#M220741</link>
      <description>&lt;P&gt;I created the following synthetic&amp;nbsp;data.&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Name $ run squat jump pushup;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Bob 1 0 0 1&lt;/P&gt;&lt;P&gt;Mat 0 1 0 1&lt;/P&gt;&lt;P&gt;Cat 1 0 1 1&lt;/P&gt;&lt;P&gt;Dog 1 0 0 0&lt;/P&gt;&lt;P&gt;Fred 0 1 1 1&lt;/P&gt;&lt;P&gt;Sam 0 0 1 0&lt;/P&gt;&lt;P&gt;Pat 0 0 0 1&lt;/P&gt;&lt;P&gt;Jack 1 1 1 1&lt;/P&gt;&lt;P&gt;Bat 0 0 0 0&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following table to fill&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;One exercise&lt;/TD&gt;&lt;TD&gt;More than one exercise&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Run&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Pushup&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jump&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Squat&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I want to know within my data when someone only do anyone of the exercise or if they did multiple exrcise. For example: When bob ran&amp;amp;pushup- he cannot be in one exercise column but dog can because he only ran. After which I will find the sum for each exercise.&lt;/P&gt;&lt;P&gt;I thought maybe I need to change my data from long to wide but have no idea of what to do next.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 23:28:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/714843#M220741</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2021-01-27T23:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the count of specific variable within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/714850#M220747</link>
      <description>This would be infinitely easier if you show a fully worked example. I have a strong suspicion of what you want but I'd be guessing. Please provide sample data and sample output that aligns, preferably using the same terms here. So given the sample data, what would you expect to see in the output? And is this representative of your data or do you also need to handle multiple days?</description>
      <pubDate>Thu, 28 Jan 2021 00:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/714850#M220747</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-28T00:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the count of specific variable within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/714983#M220796</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;If I understand you correctly the dataset I created represented how my&amp;nbsp;real data looks-like.&amp;nbsp;The output should be in percentage, so&amp;nbsp;my output&amp;nbsp;should be similar&amp;nbsp;to this table below;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;One exercise (%)&lt;/TD&gt;&lt;TD&gt;Multiple exercises(%)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;jump&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 100 (20.00)&lt;/TD&gt;&lt;TD&gt;800(79.11)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;run&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 212(24.26)&lt;/TD&gt;&lt;TD&gt;534(66.74&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;If you look at my previous dataset, in some observation two exercises e.g. jump and run have values whereas only jump has a value in another observation. I want to&amp;nbsp;know if jump was the only exercise done&amp;nbsp;or if there were two exercises-what is the counts.&amp;nbsp;One thing am not sure about is if the two output will be mutually exclusive or not. I hope this is helpful.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 13:41:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/714983#M220796</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2021-01-28T13:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the count of specific variable within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715092#M220847</link>
      <description>How did you get those numbers from the table above? It's hard to try and align the example to the output when the numbers don't align.</description>
      <pubDate>Thu, 28 Jan 2021 19:49:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715092#M220847</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-28T19:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the count of specific variable within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715133#M220864</link>
      <description>&lt;P&gt;I have can produce this using 1 Data step, two PROC TRANSPOSEs, and a PROC TABULATE.&amp;nbsp; This seems too hard.&amp;nbsp; Why is your synthetic data structured this way?&amp;nbsp; Can you choose another structure?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 21:59:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715133#M220864</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-01-28T21:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the count of specific variable within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715278#M220923</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15329"&gt;@PhilC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The numbers in the output are made up. I tried usgin this code but my output is not what I wanted. My desired output is when fent is 1 and other drugs are 0, and&amp;nbsp; when fent is 1&amp;nbsp;and other drugs is 1.&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; fent=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; fent=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; oxy=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; or hydro=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; or codeine =&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; single=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;else&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; oxy=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; or hydro=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; or codeine =&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; single =&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2021 14:23:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715278#M220923</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2021-01-29T14:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the count of specific variable within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715282#M220925</link>
      <description>&lt;P&gt;How could you have a count of 100 from only 9 input observations.&amp;nbsp; Show the report you want for the example data you posted.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2021 14:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715282#M220925</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-29T14:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the count of specific variable within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715289#M220926</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;Please ignore the initial output table. I made a mistake.&lt;/P&gt;&lt;P&gt;Using the data above, I trried the following code it seems to work but I need a second opnion to see if it work on a large dataset;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; fent=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; fent=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; sum(oxy,hydro,codeine)=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; F_drug=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;else&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; sum(oxy,hydro,codeine)&amp;gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; F_drug =&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;freq&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=test2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; F_drug;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2021 14:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715289#M220926</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2021-01-29T14:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the count of specific variable within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715361#M220946</link>
      <description>&lt;P&gt;That doesn't seem to have anything to do with your original suggested output.&amp;nbsp; Looks like you are just classifying each observation as to whether any of the list of variables is 1 or not.&amp;nbsp; It is probably easier to just code that new variable using the same 0/1 pattern as your used for the original variables.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
  set test;
  any = max(of  run squat jump pushup) ;
run;
proc freq ;
 tables any;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use the OF keyword in the MAX() function (or any function that accepts multiple inputs) will allow you to use variable lists.&amp;nbsp; So this would also work for your example since those are the only numeric variables in the dataset.&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;  any = max(of  _numeric_) ;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2021 16:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715361#M220946</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-29T16:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the count of specific variable within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715454#M220980</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc format;
  value OneExercise
    0 = "More than one exercise"
    1 = "One exercise"
    ;
data test;
 input Name $ run squat jump pushup;
 array exercise[4] run--pushup;
 OneExercise=sum(of run--pushup)=1;
 format OneExercise OneExercise.;
cards;
Bob 1 0 0 1
Mat 0 1 0 1
Cat 1 0 1 1
Dog 1 0 0 0
Fred 0 1 1 1
Sam 0 0 1 0
Pat 0 0 0 1
Jack 1 1 1 1
Bat 0 0 0 0
;
PROC SORT	;
	BY OneExercise;
RUN;
PROC TRANSPOSE DATA=test 
	OUT=Transpose1
	PREFIX=Count
	NAME=Exercise
;
	BY OneExercise;
	VAR run squat jump pushup;
PROC SORT data=Transpose1	;
	BY OneExercise Exercise;
PROC TRANSPOSE DATA=Transpose1
	OUT=Transpose2 (drop=_NAME_)
	PREFIX=Count
;
	BY OneExercise Exercise;
	VAR Count:;
PROC TABULATE DATA=Transpose2	 	;
	VAR Count1;
	CLASS OneExercise /	ORDER=UNFORMATTED MISSING;
	CLASS Exercise /	ORDER=UNFORMATTED MISSING;
	TABLE /* Row Dimension */
        Exercise =" ",
        /* Column Dimension */
        OneExercise=" "*
          Count1=" "*
            Sum=" "*f=3.0		;
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV&gt;
&lt;DIV id="IDX"&gt;
&lt;DIV&gt;
&lt;TABLE class="table" style="border-style: solid;" aria-label="Table 1"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c m header" scope="col" width="86.9565px"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TH class="c header" scope="col" width="182.609px"&gt;&lt;FONT size="3"&gt;More than one exercise&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="c header" scope="col" width="120px"&gt;&lt;FONT size="3"&gt;One exercise&lt;/FONT&gt;&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="t rowheader" scope="row" width="86.9565px"&gt;&lt;FONT size="3"&gt;jump&lt;/FONT&gt;&lt;/TH&gt;
&lt;TD width="182.609px" class="r b data"&gt;&lt;FONT size="3"&gt;3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="120px" class="r b data"&gt;&lt;FONT size="3"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="t rowheader" scope="row" width="86.9565px"&gt;&lt;FONT size="3"&gt;pushup&lt;/FONT&gt;&lt;/TH&gt;
&lt;TD width="182.609px" class="r b data"&gt;&lt;FONT size="3"&gt;5&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="120px" class="r b data"&gt;&lt;FONT size="3"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="t rowheader" scope="row" width="86.9565px"&gt;&lt;FONT size="3"&gt;run&lt;/FONT&gt;&lt;/TH&gt;
&lt;TD width="182.609px" class="r b data"&gt;&lt;FONT size="3"&gt;3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="120px" class="r b data"&gt;&lt;FONT size="3"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="t rowheader" scope="row" width="86.9565px"&gt;&lt;FONT size="3"&gt;squat&lt;/FONT&gt;&lt;/TH&gt;
&lt;TD width="182.609px" class="r b data"&gt;&lt;FONT size="3"&gt;3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="120px" class="r b data"&gt;&lt;FONT size="3"&gt;0&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 20:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-count-of-specific-variable-within-a-dataset/m-p/715454#M220980</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-03-03T20:17:04Z</dc:date>
    </item>
  </channel>
</rss>

