<?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: Counting the number of respondents who answered a question in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529560#M5563</link>
    <description>&lt;P&gt;Is this what you're looking for:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; ods select none;
proc means data=sas_communities stackods N sum maxdec=0;
var provider_type:;
ods output summary = want;
run;
ods select all;

proc print data=want;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jan 2019 21:31:10 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-01-23T21:31:10Z</dc:date>
    <item>
      <title>Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529557#M5561</link>
      <description>&lt;P&gt;Requesting help for syntax that will count the number of respondents in a survey who answered a particular question (SAMPLE DATASET BELOW). The variable type is&amp;nbsp;Check-All-That-Apply (CATA)/Multiple Response Variable. The question asks respondents to identify what type of healthcare provider they are. A respondent could be more than one type of healthcare provider.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are 14 possible responses (i.e. provider_type1-provider_type14). A value of "1" anywhere in provider_type1-provider_type14 would indicate the question has been answered. A value of "0" in provider_type1-provider_type14 would indicate the question has NOT been answered.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A respondent could be an MD and an RN, for example, in which case a value of "1&amp;nbsp;would be registered for&amp;nbsp;provider_type1 and&amp;nbsp;provider_type6 respectively.&lt;/P&gt;
&lt;PRE&gt;VAR record_id provider_type___1-provider_type___14;

LABEL
provider_type___1 = "Medical Doctor (i.e. MD)"
provider_type___2 = "Osteopathic Doctor (i.e. DO)"
provider_type___3 = "Naturopathic Doctor (i.e. ND)"
provider_type___4 = "Physicians Assistant (i.e. PA)"
provider_type___5 = "Nurse Practitioner (i.e. NP)"
provider_type___6 = "Registered Nurse (i.e. RN)"
provider_type___7 = "Pharmacist (i.e. Rph)"
provider_type___8 = "Massage therapist (i.e. LMP)"
provider_type___9 = "Acupuncturist (i.e. LAc)"
provider_type___10 = "Chiropractor (i.e. DC)"
provider_type___11 = "Clinical social worker (i.e. LCSW)"
provider_type___12 = "Physical therapist (i.e. PT)"
provider_type___13 = "Psychiatrist"
provider_type___14 = "Other";
    
TITLE "What type of licensed healthcare provider are you?";&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data WORK.SAS_COMMUNITIES;
infile datalines;
input record_id provider_type___1-provider_type___14;
datalines;
1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 1 0 0 0 0 0 0 0 0 0 0 0 0 0
4 1 0 0 0 0 0 0 0 0 0 0 0 0 0
5 1 0 0 0 0 0 0 0 0 0 0 0 0 0
6 0 0 0 0 0 1 0 0 0 0 0 0 0 0
7 0 0 0 0 0 1 0 0 0 0 0 0 0 0
8 0 0 0 0 0 1 0 0 0 0 0 0 0 0
13 1 0 0 0 0 0 0 0 0 0 0 0 0 0
16 0 0 0 0 0 0 0 0 0 0 0 0 0 1
17 0 0 0 0 0 0 0 0 0 0 0 0 0 0
18 0 0 0 0 0 0 0 0 0 0 0 0 0 0
19 0 0 0 0 0 0 1 0 0 0 0 0 0 0
21 0 0 0 0 0 1 0 0 0 0 0 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;;;;&lt;/PRE&gt;
&lt;P&gt;Thanks for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 05:18:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529557#M5561</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2019-01-24T05:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529558#M5562</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.SAS_COMMUNITIES;
    infile datalines;
    input record_id provider_type1-provider_type14;
    answered=sum(of provider_type1-provider_type14);
    datalines;
...
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 21:27:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529558#M5562</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-23T21:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529560#M5563</link>
      <description>&lt;P&gt;Is this what you're looking for:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; ods select none;
proc means data=sas_communities stackods N sum maxdec=0;
var provider_type:;
ods output summary = want;
run;
ods select all;

proc print data=want;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 21:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529560#M5563</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-23T21:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529565#M5564</link>
      <description>&lt;P&gt;This is helpful, but the "n"= 82, which is the total number of observations in the dataset (&lt;SPAN&gt;record_id&lt;/SPAN&gt; goes up to 99), as opposed to the total number of respondents who answered the question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, for&amp;nbsp;&lt;SPAN&gt;record_id = 85, provider_type___1 to&amp;nbsp;provider_type___14 contains "0". This respondent did not answer this question and should not be included in the "n".&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 21:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529565#M5564</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2019-01-23T21:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529567#M5566</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; Thanks for your assistance, but I can't get this syntax to run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;73 data WORK.SAS_COMMUNITIES;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;74 infile datalines;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;75 input record_id provider_type1-provider_type14;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;76 answered=sum(of provider_type1-provider_type14);&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;77 datalines;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="sasLogNote1_1548279800177" class="sasNote"&gt;NOTE: Invalid data for record_id in line 78 1-3.&lt;/DIV&gt;
&lt;DIV id="sasLogNote2_1548279800177" class="sasNote"&gt;NOTE: LOST CARD.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;79 ;&lt;/DIV&gt;
&lt;DIV id="sasLogNote3_1548279800177" class="sasNote"&gt;NOTE: Invalid data errors for file CARDS occurred outside the printed range.&lt;/DIV&gt;
&lt;DIV id="sasLogNote4_1548279800177" class="sasNote"&gt;NOTE: Increase available buffer lines with the INFILE n= option.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;record_id=. provider_type1=. provider_type2=. provider_type3=. provider_type4=. provider_type5=. provider_type6=. provider_type7=.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;provider_type8=. provider_type9=. provider_type10=. provider_type11=. provider_type12=. provider_type13=. provider_type14=.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;answered=. _ERROR_=1 _N_=1&lt;/DIV&gt;
&lt;DIV id="sasLogNote5_1548279800177" class="sasNote"&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of a line.&lt;/DIV&gt;
&lt;DIV id="sasLogNote6_1548279800177" class="sasNote"&gt;NOTE: The data set WORK.SAS_COMMUNITIES has 0 observations and 16 variables.&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Jan 2019 21:44:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529567#M5566</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2019-01-23T21:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529571#M5567</link>
      <description>&lt;P&gt;You put in the datalines he deleted?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data temp;
 set sas_communities;
 denom = sum(of provider_type1-provider_type14) &amp;gt;0;
 if sum(of provider_type1-provider_type14) = 0 then call missing(of provider_type1-provider_type14);
 ;
 run;


 ods select none;
proc means data=temp stackods N sum mean maxdec=4;
var provider_type: denom;
ods output summary = want;
run;
ods select all;

proc print data=want;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your data structure is problematic because you're essentially using 0 as both No and Missing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I changed the values to missing if it was actually missing, or all 0's.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I did the PROC MEANS to get the correct results desired. You can check the math by dividing the SUM by the DENOM sum, so you have 73 respondents in the data you posted.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 22:10:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529571#M5567</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-23T22:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529587#M5570</link>
      <description>&lt;P&gt;I believe we have seen some of&amp;nbsp;this question at least 3 times now. We have asked for an example of output given an example input statement and a description of logic where your "n" is different than the actual data shows. I don't believe we have gotten an example with input&amp;nbsp; and output that match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are &lt;STRONG&gt;guessing &lt;/STRONG&gt;because you are not providing sufficient details to determine your logic. You say something like 'not what I want' but not how to actually get what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pick a small enough example of data that you can manually calculate what you want. Include cases that demonstrate all the behaviors that need to be considered. Then show us the desired output for that smaller example input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may not hurt to describe what you need to do when "n" matches your expectations as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why did you pick record_id=85 when 2&amp;nbsp;or 17 or 18 or 23 &amp;nbsp;has the same behavior?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 00:11:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529587#M5570</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-24T00:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529617#M5575</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;I will attempt to explain again.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dataset above - WORK.SAS_COMMUNITIES - has 82 observations. This is a subset of the overall dataset. That number - 82 - is being used as the "n" and as the denominator for calculating Percent (of Respondents) in the last column of the attached PROC TABULATE output/table (See below). I want the "n" and the denominator to be the number of respondents who have answered the question, not the number of observations in the dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are correct,&amp;nbsp;record_id=2, 17, 18, 23, 38, 41, 61, 85, and 86 exhibit "the same behavior" (i.e.&amp;nbsp;A value of "0" in provider_type1-provider_type14 when the question has NOT been answered.). 82 - 9 &amp;nbsp;= 73. I don't know how to calculate this in SAS, so I am doing it manually. I hope I identified the correct number, 9.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;73 out of 82 respondents answered this question, according to the&amp;nbsp;WORK.SAS_COMMUNITIES dataset. Therefore, 73, in this example, is the "n" and the denominator I am seeking.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the syntax I am using:&lt;/P&gt;
&lt;PRE&gt;PROC TABULATE DATA=WORK.SAS_COMMUNITIES ORDER=formatted; 
	VAR provider_type___1-provider_type___14 record_id;
	
	TABLE provider_type___1 - provider_type___14 ,
			(n='n'*f=7. Sum='Count'*f=7. mean='Percent'*f=percent8.1);
   LABEL
	provider_type___1	= "Medical Doctor (i.e. MD)"
	provider_type___2   = "Osteopathic Doctor (i.e. DO)"
	provider_type___3 	= "Naturopathic Doctor (i.e. ND)"
	provider_type___4	= "Physicians Assistant (i.e. PA)"
	provider_type___5	= "Nurse Practitioner (i.e. NP)"
	provider_type___6	= "Registered Nurse (i.e. RN)"
	provider_type___7	= "Pharmacist (i.e. Rph)"
	provider_type___8	= "Massage therapist (i.e. LMP)"
	provider_type___9   = "Acupuncturist (i.e. LAc)"
	provider_type___10	= "Chiropractor (i.e. DC)"
	provider_type___11   = "Clinical social worker (i.e. LCSW)"
	provider_type___12 	= "Physical therapist (i.e. PT)"
	provider_type___13	= "Psychiatrist"
	provider_type___14	= "Other";
    
    TITLE "What type of licensed healthcare provider are you?";
RUN;

*-----------------------------------------------;
* PROVIDER TYPE - LICENSED - SORTED;
*-----------------------------------------------;

DATA data_working_keep;
	KEEP record_id provider_type___1-provider_type___14;
	SET WORK.SAS_COMMUNITIES;
	
	LABEL 
	provider_type___1	= "Medical Doctor (i.e. MD)"
   	provider_type___2   = "Osteopathic Doctor (i.e. DO)"
   	provider_type___3 	= "Naturopathic Doctor (i.e. ND)"
	provider_type___4	= "Physicians Assistant (i.e. PA)"
	provider_type___5	= "Nurse Practitioner (i.e. NP)"
	provider_type___6	= "Registered Nurse (i.e. RN)"
	provider_type___7	= "Pharmacist (i.e. Rph)"
	provider_type___8	= "Massage therapist (i.e. LMP)"
	provider_type___9   = "Acupuncturist (i.e. LAc)"
	provider_type___10	= "Chiropractor (i.e. DC)"
	provider_type___11   = "Clinical social worker (i.e. LCSW)"
	provider_type___12 	= "Physical therapist (i.e. PT)"
	provider_type___13	= "Psychiatrist"
	provider_type___14	= "Other";	
RUN;

proc sort data=data_working_keep;
   by  record_id;
run;

Proc transpose data=data_working_keep
   out=trans_mchps;
	by record_id;
run;

*proc tabulate data=trans_mchps;
  *where col1=1;
  *class _label_ /order=freq;
  *label _label_='Response';
  *table _label_ all='Total',
        n='n'*f=best6. colpctn='%'
      /
   ;
*run;

proc summary data=trans_mchps;
   class _label_;
   var col1;
   output out=transsum n= sum=/autoname;
run;

proc sort data=transsum;
   by descending _type_ descending col1_sum ;
run;

data display;
  set transsum;
  if missing(_label_) then do;
      _label_ ='Total';
      percent= 999;
  end;
  else percent = 10.*(col1_sum/col1_n);
run;

proc print data=display noobs label;
   var _label_;
   var col1_sum / style(data)={just=c};
   var percent / style(data)={just=c}; 
   label _label_='Response'
         col1_sum='Number selected'
         percent='Percent of Respondents'
   ;
   format col1_sum best6. percent f5.1;
   
   TITLE "What type of licensed healthcare provider are you?";
   TITLE2 "NOTE: This is a multiple response variable (i.e. Check all that apply) so the column does not sum to 100%";
   TITLE3 "Percent of RESPONDENTS, not responses ";
   TITLE4 "n = TBD";
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "n" in the first table (Unsorted) is 82. I would like it to be 73. Same for the second table (Sorted).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="licensed providers 4.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26529i4993D85D4FEA3278/image-size/large?v=v2&amp;amp;px=999" role="button" title="licensed providers 4.jpg" alt="licensed providers 4.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I understand if you are frustrated. Please know that you are no more frustrated than I. Trying to decipher suggested syntax and interpret the SAS vernacular used in many of the responses&amp;nbsp;to my posts are both very&amp;nbsp;challenging. I am not a SAS expert.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your time and assistance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 05:56:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529617#M5575</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2019-01-24T05:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529621#M5576</link>
      <description>&lt;P&gt;Did you try my solution? The mean are the percents, isn’t that what you wanted?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 06:21:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529621#M5576</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-24T06:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529765#M5598</link>
      <description>&lt;P&gt;Another stab&lt;/P&gt;
&lt;PRE&gt;data WORK.SAS_COMMUNITIES;
   infile datalines;
   input record_id provider_type___1-provider_type___14;
   array p provider_: ;
   if sum(of p(*))=0 then call missing(of p(*));
   LABEL
	provider_type___1	= "Medical Doctor (i.e. MD)"
	provider_type___2   = "Osteopathic Doctor (i.e. DO)"
	provider_type___3 	= "Naturopathic Doctor (i.e. ND)"
	provider_type___4	= "Physicians Assistant (i.e. PA)"
	provider_type___5	= "Nurse Practitioner (i.e. NP)"
	provider_type___6	= "Registered Nurse (i.e. RN)"
	provider_type___7	= "Pharmacist (i.e. Rph)"
	provider_type___8	= "Massage therapist (i.e. LMP)"
	provider_type___9   = "Acupuncturist (i.e. LAc)"
	provider_type___10	= "Chiropractor (i.e. DC)"
	provider_type___11   = "Clinical social worker (i.e. LCSW)"
	provider_type___12 	= "Physical therapist (i.e. PT)"
	provider_type___13	= "Psychiatrist"
	provider_type___14	= "Other"
   ;
datalines;
1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 1 0 0 0 0 0 0 0 0 0 0 0 0 0
4 1 0 0 0 0 0 0 0 0 0 0 0 0 0
5 1 0 0 0 0 0 0 0 0 0 0 0 0 0
6 0 0 0 0 0 1 0 0 0 0 0 0 0 0
7 0 0 0 0 0 1 0 0 0 0 0 0 0 0
8 0 0 0 0 0 1 0 0 0 0 0 0 0 0
13 1 0 0 0 0 0 0 0 0 0 0 0 0 0
16 0 0 0 0 0 0 0 0 0 0 0 0 0 1
17 0 0 0 0 0 0 0 0 0 0 0 0 0 0
18 0 0 0 0 0 0 0 0 0 0 0 0 0 0
19 0 0 0 0 0 0 1 0 0 0 0 0 0 0
21 0 0 0 0 0 1 0 0 0 0 0 0 0 0
22 0 0 0 0 0 1 0 0 0 0 0 0 0 0
23 0 0 0 0 0 0 0 0 0 0 0 0 0 0
24 1 0 0 0 0 0 0 0 0 0 0 0 0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 0 0 0 0 1 0 0 0 0 0 0 0 0 0
65 0 0 0 0 0 0 0 0 0 0 0 0 0 1
66 0 0 0 0 1 0 0 0 0 0 0 0 0 0
67 0 0 0 0 1 0 0 0 0 0 0 0 0 0
68 0 0 0 0 0 1 0 0 0 0 0 0 0 0
69 0 0 0 0 1 0 0 0 0 0 0 0 0 0
71 0 0 0 0 0 1 0 0 0 0 0 0 0 0
72 0 0 0 0 0 1 0 0 0 0 0 0 0 0
73 0 0 0 0 0 1 0 0 0 0 0 0 0 0
74 0 0 1 0 1 0 0 0 0 0 0 0 0 0
75 0 0 0 0 0 1 0 0 0 0 0 0 0 0
76 0 0 0 0 0 1 0 0 0 0 0 0 0 0
77 0 0 0 0 1 0 0 0 0 0 0 0 0 0
78 0 0 0 0 0 1 0 0 0 0 0 0 0 0
81 0 0 1 0 0 0 0 0 0 0 0 0 0 0
82 0 0 0 0 0 1 0 0 0 0 0 0 0 1
83 0 0 0 0 0 1 0 0 0 0 0 0 0 0
85 0 0 0 0 0 0 0 0 0 0 0 0 0 0
86 0 0 0 0 0 0 0 0 0 0 0 0 0 0
87 1 0 0 0 0 0 0 0 0 0 0 0 0 0
88 1 0 0 0 0 0 0 0 0 0 0 0 0 0
89 0 0 0 0 0 1 0 0 0 0 0 0 0 0
90 0 0 0 0 0 1 0 0 0 0 0 0 0 0
91 0 0 0 0 0 1 0 0 0 0 0 0 0 0
92 0 0 0 0 0 1 0 0 0 0 0 0 0 0
94 0 0 0 0 0 1 0 0 0 0 0 0 0 0
95 0 0 0 0 0 1 0 0 0 0 0 0 0 0
96 0 0 0 0 0 1 0 0 0 0 0 0 0 0
97 0 0 0 0 0 1 0 0 0 0 0 0 0 0
98 0 0 0 0 0 1 0 0 0 0 0 0 0 0
99 0 0 0 0 1 0 0 0 0 0 0 0 0 0
 ;;;;

 PROC TABULATE DATA=WORK.SAS_COMMUNITIES ORDER=formatted ; 
	VAR provider_type___1-provider_type___14 record_id;
	
	TABLE provider_type___1 - provider_type___14 ,
			(n='n'*f=7. Sum='Count'*f=7. mean='Percent'*f=percent8.1);
run;
Proc transpose data=WORK.SAS_COMMUNITIES
  label=_label_ out=work.trans_mchps ;
	by record_id;
run;
proc summary data=work.trans_mchps ;
   class _label_;
   var col1;
   output out=work.summary  sum= n= /autoname;
run;

proc sort data=work.summary;
  by descending _type_ descending col1_sum;
run;

data work.print;
   set work.summary;
   if _type_=0 then do;
      _label_='Total';
      pct=.;/* this remains problematic*/
   end;
   else  pct = 100*col1_sum/col1_n;
   label
      _label_ = "Response"
      col1_sum= "Number Selected"
      pct     = "Percent of Respondents"
   ;
run;

proc print data=work.print noobs label;
   var _label_ col1_sum pct;
   format pct f5.1;
run;
   


&lt;/PRE&gt;
&lt;P&gt;I don't think you have stated what you want for percentage in the "total" of the last table. I'm not sure 100 is appropriate. The _freq_ variable in the work.summary set used in work.print could be captured to use the 82 of raw respondents to get a 77/82 as a percentage of respondents with at least one selection if that is the desired percentage.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 17:31:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529765#M5598</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-24T17:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529858#M5610</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;Yes, this is what I was asking for in this thread. Thank you!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In &lt;A href="https://communities.sas.com/t5/SAS-Programming/Counts-and-Percentages-in-Multiple-Response-Variables/m-p/529264#M144562" target="_self"&gt;another thread&lt;/A&gt; I had been seeking a more comprehensive solution using PROC TABULATE. This is what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;was referring to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 20:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/529858#M5610</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2019-01-24T20:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530200#M5692</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;This is great. Thank you so much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;I don't think you have stated what you want for percentage in the "total" of the last table.&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's correct. I didn't. I don't think it makes sense because it sums to over 100%.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For some reason, when I adapt your syntax to the overall dataset, there is a problem w/ the array (see syntax below): "All variables in array list must be the same type, i.e., all numeric or character."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A PROC CONTENTS shows that all the variables in the array ARE the same type - numeric. I don't understand arrays very well. Can you tell what I'm doing wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA data_working_keep;
	KEEP record_id provider_type___1-provider_type___14;
	SET mchps.data_working;
	
	array p provider_: ;
   	if sum(of p(*))=0 then call missing(of p(*));
   
	LABEL 
	provider_type___1	= "Medical Doctor (i.e. MD)"
   	provider_type___2   = "Osteopathic Doctor (i.e. DO)"
   	provider_type___3 	= "Naturopathic Doctor (i.e. ND)"
	provider_type___4	= "Physicians Assistant (i.e. PA)"
	provider_type___5	= "Nurse Practitioner (i.e. NP)"
	provider_type___6	= "Registered Nurse (i.e. RN)"
	provider_type___7	= "Pharmacist (i.e. Rph)"
	provider_type___8	= "Massage therapist (i.e. LMP)"
	provider_type___9   = "Acupuncturist (i.e. LA.c)"
	provider_type___10	 = "Chiropractor (i.e. DC)"
	provider_type___11 = "Clinical social worker (i.e. LCSW)"
	provider_type___12 = "Physical therapist (i.e. PT)"
	provider_type___13	= "Psychiatrist"
	provider_type___14	= "Other";	
RUN;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Jan 2019 20:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530200#M5692</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2019-01-25T20:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530202#M5694</link>
      <description>recordID is listed in the VAR statement as well. Is that numeric or character?</description>
      <pubDate>Fri, 25 Jan 2019 20:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530202#M5694</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-25T20:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530207#M5697</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="licensed providers 5.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26586i66CCE5B529D237CE/image-size/large?v=v2&amp;amp;px=999" role="button" title="licensed providers 5.jpg" alt="licensed providers 5.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 20:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530207#M5697</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2019-01-25T20:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530208#M5698</link>
      <description>The SAS log is rarely wrong. I suggest posting the full code/log. The log usually indicates where to check, ie which line and which variable. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Jan 2019 20:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530208#M5698</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-25T20:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530210#M5700</link>
      <description>&lt;P&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt;72 &lt;BR /&gt;73 DATA data_working_keep;&lt;BR /&gt;74 KEEP record_id provider_type___1-provider_type___14;&lt;BR /&gt;75 SET mchps.data_working;&lt;BR /&gt;76 &lt;BR /&gt;77 array p provider_: ;&lt;BR /&gt;ERROR: All variables in array list must be the same type, i.e., all numeric or character.&lt;BR /&gt;ERROR: All variables in array list must be the same type, i.e., all numeric or character.&lt;BR /&gt;78 if sum(of p(*))=0 then call missing(of p(*));&lt;BR /&gt;79 &lt;BR /&gt;80 LABEL&lt;BR /&gt;81 provider_type___1= "Medical Doctor (i.e. MD)"&lt;BR /&gt;82 provider_type___2 = "Osteopathic Doctor (i.e. DO)"&lt;BR /&gt;83 provider_type___3 = "Naturopathic Doctor (i.e. ND)"&lt;BR /&gt;84 provider_type___4= "Physicians Assistant (i.e. PA)"&lt;BR /&gt;85 provider_type___5= "Nurse Practitioner (i.e. NP)"&lt;BR /&gt;86 provider_type___6= "Registered Nurse (i.e. RN)"&lt;BR /&gt;87 provider_type___7= "Pharmacist (i.e. Rph)"&lt;BR /&gt;88 provider_type___8= "Massage therapist (i.e. LMP)"&lt;BR /&gt;89 provider_type___9 = "Acupuncturist (i.e. LA.c)"&lt;BR /&gt;90 provider_type___10= "Chiropractor (i.e. DC)"&lt;BR /&gt;91 provider_type___11 = "Clinical social worker (i.e. LCSW)"&lt;BR /&gt;92 provider_type___12 = "Physical therapist (i.e. PT)"&lt;BR /&gt;93 provider_type___13= "Psychiatrist"&lt;BR /&gt;94 provider_type___14= "Other";&lt;BR /&gt;95 RUN;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;78:15&lt;/STRONG&gt; &lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set WORK.DATA_WORKING_KEEP may be incomplete. When this step was stopped there were 0 observations and 15 &lt;BR /&gt;variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.02 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 20:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530210#M5700</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2019-01-25T20:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530211#M5701</link>
      <description>&lt;P&gt;The error is saying that there are mixed types in the ARRAY then perhaps there are other variables in your dataset that have names that start with that prefix.&amp;nbsp; If you only want to keep some of the variables why are you bringing all of them into the data step?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SET mchps.data_working(KEEP=record_id provider_type___1-provider_type___14);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also why are you making the ARRAY?&amp;nbsp; It is not needed for your code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if sum(of provider_type___1-provider_type___14)=0 then 
  call missing(of provider_type___1-provider_type___14)
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 20:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530211#M5701</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-25T20:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of respondents who answered a question</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530238#M5713</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36911"&gt;@_maldini_&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;This is great. Thank you so much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;I don't think you have stated what you want for percentage in the "total" of the last table.&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's correct. I didn't. I don't think it makes sense because it sums to over 100%.&amp;nbsp;&lt;FONT color="#ff0000"&gt;You could manually assign a value such as 100 in the data step that creates the "Total" label OR the value of your wanted denominator / actual total respondents but that would likely require an explanation&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For some reason, when I adapt your syntax to the overall dataset, there is a problem w/ the array (see syntax below): "All variables in array list must be the same type, i.e., all numeric or character."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A PROC CONTENTS shows that all the variables in the array ARE the same type - numeric. I don't understand arrays very well. Can you tell what I'm doing wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you have another variable in the actual data set that starts with Provider_ then the short cut will try to include that. Remember that your KEEP statement sets which variables go to the OUTPUT data set. All the other variables are on the data vector.&lt;/P&gt;
&lt;P&gt;Likely the fix would be to explicitly list the variable range.&lt;/P&gt;
&lt;PRE&gt;array p provider_type___1 - provider_type___14 ;&lt;/PRE&gt;
&lt;P&gt;I don't allow my programs to create variables with multiple _ characters and was just avoiding typing them.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 21:44:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-number-of-respondents-who-answered-a-question/m-p/530238#M5713</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-25T21:44:45Z</dc:date>
    </item>
  </channel>
</rss>

