BookmarkSubscribeRSS Feed
_maldini_
Barite | Level 11

I am seeking help analyzing multiple response variables ("Check all that apply"). I have no experience with this variable type. I received help last Fall (https://communities.sas.com/t5/SAS-Programming/Analyzing-Multiple-Response-Variables/m-p/487178#M126...), but I am now revisiting these data and realizing there is a mistake.

 

Sample data below.

 

I am trying to produce a table (See attached picture) that includes a count for each response, a count for each respondent and the percentage of respondents who selected a given response.

 

For example, "What type of licensed healthcare provider are you?" An individual could be an MD and an RN, for example. The desired table would include: MD = X responses, RN = X responses, etc.; n=XX (This is the number of respondents who answered the question); MD = XX%, RN = XY% (This is the percent of respondents answering the question that selected a given response. In other words, XX% of respondents selected MD.)

 

The syntax below uses the total number of the respondents as the denominator in the percentage calculation. It needs to use the number of respondents who answered the question instead.

 

Thanks for your help!! I am a fairly novice SAS users. 

 

Sample dataset:

 

data WORK.SAS_COMMUNITIES;
   infile datalines dsd truncover;
 input record_id:BEST12. redcap_survey_identifier:$500. mchp_survey_timestamp:$500. consent_new:BEST32. advise:BEST12. licensed:BEST12. provider_type___1:BEST12. provider_type___2:BEST12. provider_type___3:BEST12. provider_type___4:BEST12. provider_type___5
 :BEST12. provider_type___6:BEST12. provider_type___7:BEST12. provider_type___8:BEST12. provider_type___9:BEST12. provider_type___10:BEST12. provider_type___11:BEST12. provider_type___12:BEST12. provider_type___13:BEST12. provider_type___14:BEST12.;
 format record_id BEST12. consent_new BEST32. advise BEST12. licensed BEST12. provider_type___1 BEST12. provider_type___2 BEST12. provider_type___3 BEST12. provider_type___4 BEST12. provider_type___5 BEST12. provider_type___6 BEST12. provider_type___7 BEST1
 2. provider_type___8 BEST12. provider_type___9 BEST12. provider_type___10 BEST12. provider_type___11 BEST12. provider_type___12 BEST12. provider_type___13 BEST12. provider_type___14 BEST12.;
 datalines;
 . redcap_survey_identifier mchp_survey_timestamp . . . . . . . . . . . . . . . . .
 1   [not completed] . 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 2   [not completed] . 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 3   2018-06-29 06:11:48 . 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
 4   [not completed] . 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
 5   2018-06-29 11:38:40 . 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
 6   [not completed] . 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 7   2018-06-29 09:11:20 . 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 8   [not completed] . 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 9   [not completed] . . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 10   [not completed] . . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 11   [not completed] . . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 12   [not completed] . . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 13   [not completed] . 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
 14   [not completed] . . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 15   [not completed] . . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 16   [not completed] . 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1
 17   [not completed] . 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 18   2018-06-30 01:25:31 . 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 19   [not completed] . 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0
 20   [not completed] . . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 21   [not completed] . 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 22   [not completed] . 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 23   2018-06-30 12:13:03 . 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 24   [not completed] . 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
 ;;;;

 

Existing code: 

*-----------------------------------------------;
* PROVIDER TYPE - LICENSED - UNSORTED;
*-----------------------------------------------;

PROC TABULATE DATA=mchps.data_working 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. 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";
    
    TITLE "What type of licensed healthcare provider are you?";
RUN;

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

DATA data_working_keep;
	KEEP record_id gender provider_type___1-provider_type___14;
	SET mchps.data_working;
	
	WHERE licensed = 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. 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;

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 = 100*(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;

licensed providers.jpg

 @ballardw

6 REPLIES 6
ballardw
Super User

You might try copying your pasted data step for Work.sascommunities, run the code  and see if the results make sense.

 

I suggest removing first data line and the variables  associated as it has nothing to do with your question. Also remove the timestamp variables as the code is reading them incorrectly as well.

data WORK.SAS_COMMUNITIES;
   infile datalines  truncover;
 input record_id  provider_type___1 provider_type___2 provider_type___3 provider_type___4 provider_type___5
  provider_type___6 provider_type___7 provider_type___8 provider_type___9 provider_type___10 provider_type___11 provider_type___12 provider_type___13 provider_type___14;
 format record_id provider_type: BEST12.;
 datalines;
 1    1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 2    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 3    1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
 4    1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
 5    1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
 6    1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 7    1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 8    1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 9    . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 10    . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 11    . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 12    . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 13    1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
 14    . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 15    . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 16    1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1
 17    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 18    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 19    1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0
 20    . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 21    1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 22    1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
 23    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 24    1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
 ;;;;

Will run.

 

 

Now to the details. For the above data what would the denominator be? Use the example data to post results if discussing the values.

 

Referencing data we don't have, either 171 or 142. And where does 142 come from as the proc freq looks like 154 is more likely unless that means you are excluding the 12 "Other" responses. In which case you need to tell us that you are excluding

provider_type___14 from something (and possibly not others)

 

When I run the first proc tabulate with the example data above I get

What type of licensed healthcare provider are you?

-------------------------------------------------
|                      |   n   | Count |Percent |
|----------------------+-------+-------+--------|
|Medical Doctor (i.e.  |       |       |        |
|MD)                   |     17|     17| 100.0% |
|----------------------+-------+-------+--------|
|Osteopathic Doctor    |       |       |        |
|(i.e. DO)             |     17|     13|  76.5% |
|----------------------+-------+-------+--------|
|Naturopathic Doctor   |       |       |        |
|(i.e. ND)             |     24|      5|  20.8% |
|----------------------+-------+-------+--------|
|Physicians Assistant  |       |       |        |
|(i.e. PA)             |     24|      0|   0.0% |
|----------------------+-------+-------+--------|
|Nurse Practitioner    |       |       |        |
|(i.e. NP)             |     24|      0|   0.0% |
|----------------------+-------+-------+--------|
|Registered Nurse (i.e.|       |       |        |
|RN)                   |     24|      0|   0.0% |
|----------------------+-------+-------+--------|
|Pharmacist (i.e. Rph) |     24|      0|   0.0% |
|----------------------+-------+-------+--------|
|Massage therapist     |       |       |        |
|(i.e. LMP)            |     24|      6|  25.0% |
|----------------------+-------+-------+--------|
|Acupuncturist (i.e.   |       |       |        |
|LA.c)                 |     24|      1|   4.2% |
|----------------------+-------+-------+--------|
|Chiropractor (i.e. DC)|     24|      0|   0.0% |
|----------------------+-------+-------+--------|
|Clinical social worker|       |       |        |
|(i.e. LCSW)           |     24|      0|   0.0% |
|----------------------+-------+-------+--------|
|Physical therapist    |       |       |        |
|(i.e. PT)             |     24|      0|   0.0% |
|----------------------+-------+-------+--------|
|Psychiatrist          |     24|      0|   0.0% |
|----------------------+-------+-------+--------|
|Other                 |     24|      0|   0.0% |
-------------------------------------------------

Which shows the responses to the individual questions as the denominators, not the overall number of records.

 

So there is likely something different about your data and we need descriptions of all of the filter rules and data values in example data to allow implementation.

 

Instead of code that doesn't quite work to create data use the macro here to create code. If you had done that previously then be very careful of editing the code.

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

_maldini_
Barite | Level 11

I used the "How to create a data step version of your data AKA generate sample data for forums" post to create the dataset, but I didn't run the code to ensure it worked. I should have. My apologies.

 

171 and 142 are numbers from the overall dataset, not the subset I created for this post. 

 

In the Proc Tabulate output you pasted below, 17 out of 24 respondents answered the question. You're correct, 17 is the denominator I am seeking, but 24 is not. I'm not sure why it changes from 17 to 24 in the table. In all my output - prior to this post - the "n" has always been the same number (i.e. 171, the total number of respondents in the dataset) (See uploaded image). 

 

 

ballardw
Super User

@_maldini_ wrote:

I used the "How to create a data step version of your data AKA generate sample data for forums" post to create the dataset, but I didn't run the code to ensure it worked. I should have. My apologies.

 

171 and 142 are numbers from the overall dataset, not the subset I created for this post. 

 

In the Proc Tabulate output you pasted below, 17 out of 24 respondents answered the question. You're correct, 17 is the denominator I am seeking, but 24 is not. I'm not sure why it changes from 17 to 24 in the table. In all my output - prior to this post - the "n" has always been the same number (i.e. 171, the total number of respondents in the dataset) (See uploaded image). 

 

 


The value of each variable should appear for each record in the data lines. Since there were some variables that were defined with $500 perhaps we have a problem in the results generated by the macro and copy/paste to the forum. The SAS editor really doesn't like lines that are 1000's of characters long. So perhaps excluding those variables from the data before using the macro would help. Generally only include variables that are needed for the discussion at hand.

 

In the proc tabulate code I ran the number of the denominator changes from 17 to 24 because there were some records that had missing values for the first two provider variables. The N statistic does not count missing values.

Perhaps you did not see that behavior because your code in places has a filter on a LICENSED variable that does not appear in the data step example data?

 

Which still leaves the question of HOW did you get the 142 as your desired denominator? And what would it be for the example data?

_maldini_
Barite | Level 11

<Which still leaves the question of HOW did you get the 142 as your desired denominator?>

 

If I recall correctly, 142 is the number of respondents that answered that question, out of 171 respondents in the overall dataset. This is analogous to 17 respondents that answered that question out of 24 respondents in the sample dataset I uploaded.

 

<And what would it be for the example data?>

 

It would be 17, the number of respondents who answered the question. 

 

<there were some records that had missing values for the first two provider variables>

 

I'm not sure why missing values were recorded for provider_type___1 and provider_type___2 for a respondent that skipped the question, but "0" was recorded for for provider_type___3-provider_type___14. 

 

There are no such missing values in the overall dataset. 

 

 Here is the entire dataset, as generated by this procedure.

   data WORK.SAS_COMMUNITIES;
infile datalines dsd truncover;
input record_id:BEST12. provider_type___1:BEST12. provider_type___2:BEST12. provider_type___3:BEST12. provider_type___4:BEST12. provider_type___5:BEST12. provider_type___6:BEST12. provider_type___7:BEST12. provider_type___8:BEST12. provider_type___9:BEST12
. provider_type___10:BEST12. provider_type___11:BEST12. provider_type___12:BEST12. provider_type___13:BEST12. provider_type___14:BEST12.;
format record_id BEST12. provider_type___1 BEST12. provider_type___2 BEST12. provider_type___3 BEST12. provider_type___4 BEST12. provider_type___5 BEST12. provider_type___6 BEST12. provider_type___7 BEST12. provider_type___8 BEST12. provider_type___9 BEST1
2. provider_type___10 BEST12. provider_type___11 BEST12. provider_type___12 BEST12. provider_type___13 BEST12. provider_type___14 BEST12.;
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 0
25 1 0 0 0 0 0 0 0 0 0 0 0 0 0
26 0 0 0 0 0 1 0 0 0 0 0 0 0 0
27 0 0 0 0 0 1 0 0 0 0 0 0 0 0
28 1 0 0 0 0 0 0 0 0 0 0 0 0 0
30 0 0 0 0 0 1 0 0 0 0 0 0 0 0
31 1 0 0 0 0 0 0 0 0 0 0 0 0 0
33 0 0 0 0 0 1 0 0 0 0 0 0 0 0
34 0 0 0 0 0 0 0 0 0 0 0 0 0 1
35 0 0 0 0 0 1 0 0 0 0 0 0 0 0
36 0 0 0 0 0 1 0 0 0 0 0 0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 0 0 0 1 0 0 0 0 0
205 0 0 0 0 0 0 0 0 1 0 0 0 0 0
206 0 0 1 0 0 0 0 0 1 0 0 0 0 0
207 0 0 1 0 0 0 0 0 0 0 0 0 0 0
208 0 0 1 0 0 0 0 0 0 0 0 0 0 0
209 0 0 1 0 0 0 0 0 0 0 0 0 0 0
210 0 0 0 0 1 0 0 0 0 0 0 0 0 0
211 0 0 1 0 0 0 0 0 0 0 0 0 0 0
;;;;

 

ChrisHemedinger
Community Manager

I don't have an answer, but here's a simplified SAS program that will read the data and make it easier for others to help.

 

 data WORK.SAS_COMMUNITIES;
infile datalines;
 input record_id provider_type1-provider_type13;
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 0
25 1 0 0 0 0 0 0 0 0 0 0 0 0 0
26 0 0 0 0 0 1 0 0 0 0 0 0 0 0
27 0 0 0 0 0 1 0 0 0 0 0 0 0 0
28 1 0 0 0 0 0 0 0 0 0 0 0 0 0
30 0 0 0 0 0 1 0 0 0 0 0 0 0 0
31 1 0 0 0 0 0 0 0 0 0 0 0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 1 0 0 0 0 0 0 0 0
201 0 0 0 0 0 0 0 0 0 0 0 0 0 0
202 0 0 0 0 0 1 0 0 0 0 0 0 0 0
203 0 0 0 0 0 0 0 0 0 0 0 0 0 0
204 0 0 1 0 0 0 0 0 1 0 0 0 0 0
205 0 0 0 0 0 0 0 0 1 0 0 0 0 0
206 0 0 1 0 0 0 0 0 1 0 0 0 0 0
207 0 0 1 0 0 0 0 0 0 0 0 0 0 0
208 0 0 1 0 0 0 0 0 0 0 0 0 0 0
209 0 0 1 0 0 0 0 0 0 0 0 0 0 0
210 0 0 0 0 1 0 0 0 0 0 0 0 0 0
211 0 0 1 0 0 0 0 0 0 0 0 0 0 0
 ;;;;
Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
_maldini_
Barite | Level 11

Thanks Chris. One correction: There are 14 provider type responses, not 13.

 

input record_id provider_type1-provider_type14;

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1447 views
  • 0 likes
  • 3 in conversation