a concise display of multiple response items patrick thornton
TRANSCRIPT
![Page 1: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/1.jpg)
A Concise Display of Multiple Response Items
Patrick Thornton
![Page 2: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/2.jpg)
Multiple Response Items: Outline
Example item, response & indicator variables
Summarize responses using indicator variables and a PROC FREQ
Summarizing responses into a single table
– Create binary variable from indicators variables
– Create a decimal variable from the binary
– Create a MULTILABEL format for the decimal
– Summarize responses in PROC TABULATE
Conclusion
![Page 3: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/3.jpg)
Multiple Response Item with Example Responses
Are you proficient at speaking the following languages (answer all that apply)?
– Spanish (yes)
– English (yes)
– Chinese (no)
![Page 4: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/4.jpg)
Language Indicator Variables to Store the Responses
data mydata;
length e1-e3 gender 8.;
label e1 = 'Spanish' e2='English' e3='Chinese' gender='Gender';
input e1 e2 e3 gender;
cards;
1 1 0 1
;run;
![Page 5: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/5.jpg)
Formatting Language Indicator Variables
proc format;
value yesno 1 = 'Yes' 0 = 'No';
value gender 1 ='Male' 2 = 'Female';
run;
data mydata;
set mydata;
format e1-e3 yesno. gender gender.;
run;
![Page 6: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/6.jpg)
Using PROC FREQ and the Indicator Variables to Display Language Responses
TITLE1 “Standard Reporting Generates a Table for Each Variable”;
PROC FREQ data=mydata;
TABLE e1-e3;
run;
![Page 7: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/7.jpg)
Using PROC FREQ and the Indicator Variables to Display Language Responses
![Page 8: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/8.jpg)
Using PROC FREQ and the Indicator Variables to Display Language Responses
![Page 9: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/9.jpg)
Using PROC TABULATE to Display the Language Responses
![Page 10: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/10.jpg)
Creating Binary Variable from the Indicator Variables
data mydata;
set mydata;
length language_binary $3.;
language_binary = strip(catt(of e3 e2 e1));
run;
![Page 11: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/11.jpg)
List Indicator and Binary Variables
![Page 12: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/12.jpg)
Create a MULTILABEL Format based on 3 Character Binary Variable
Proc format;
value $langf (multilabel notsorted )
'000' = 'Missing'
'001','011','101','111' = 'Spanish'
'010','011','110','111'= 'English'
'100','101','110','111'='Chinese';
run;
![Page 13: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/13.jpg)
List Indicator and Binary Variables
![Page 14: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/14.jpg)
Create a MULTILABEL Format based on 2 Character Binary Variable
Proc format;
value $langf (multilabel notsorted)
'00' = 'Missing'
'01','11' = 'Spanish'
'10','11', = 'English';
Run;
![Page 15: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/15.jpg)
Creating Binary and Decimal Variables from the Indicator Variables
data mydata;
set mydata;
length language_binary $3. language_profile 8.;
language_binary = strip(catt(of e3 e2 e1));
language_profile=input(language_binary,binary3.);
run;
![Page 16: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/16.jpg)
Listing of Binary and Decimal Variables
![Page 17: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/17.jpg)
MULTILABEL Format to Label Decimal Values
Proc format;
value langf (multilabel notsorted )
0 = 'Missing'
1,3,5,7 = 'Spanish'
2,3,6,7= 'English'
4,5,6,7= 'Chinese';
Run;
![Page 18: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/18.jpg)
PROC TABULATE, MULTILABEL, and Decimal Variable
proc tabulate data=mydata ;
class language_profile /ORDER=DATA PRELOADFMT MLF;
table language_profile="Language" all='Total',
(n* format=10.0 pctn='%'*format=7.1)/
box='Table 1 Student reported language proficiency'
rtspace=20;
format language_profile $langf. ;
run;
![Page 19: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/19.jpg)
Single Table Display of Multiple Response Language Item
![Page 20: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/20.jpg)
PROC TABULATE, MULTILABEL, Decimal Variable, and Column Variable
proc tabulate data=mydata ;
class language_profile /ORDER=DATA PRELOADFMT MLF;
class gender;
table language_profile="Language" all='Total', gender*
(n* format=10.0 pctn='%'*format=7.1)/
box='Table 2 Student reported language proficiency by gender'
rtspace=20;
format language_profile $langf. ;
run;
![Page 21: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/21.jpg)
Single Table Display of Multiple Response Language Item and Gender
![Page 22: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/22.jpg)
Macro Program for Creating the Multi-Label Format
Thornton, P. (2013). A Concise Display of Multiple Response Items. Proceedings of the 2013 SAS Global Forum, San Francisco, CA
![Page 23: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/23.jpg)
Bonus: BAND Function – Is it useful?
BAND is a function that performs a bitwise AND operation on two arguments
– The result is a multiplication of each position in the binary form of two numbers
– x=BAND (arg1,arg2)
• Arg1 = 001
• Arg2 = 001
• X = 1
– By passing 001 as Arg2, I can confirm a 1 is in the same position in Arg1
![Page 24: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/24.jpg)
Is it useful to subset OBS with BAND?
proc print data=mydata label;
var language_binary language_profile e3-e1;
where e1 = 1;
run;
proc print data=mydata label;
var language_binary language_profile e3-e1;
where band(language_profile,001);
run;
![Page 25: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/25.jpg)
Test of the BAND Function
![Page 26: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/26.jpg)
Test of the BAND Function (con’t)
![Page 27: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/27.jpg)
It does seem possible to subset OBS based on BAND
proc print data=example label;
var language_binary language_profile e6-e1;
where band(language_profile,101010);
run;
Data subset;
set example;
if band(language_profile,101010);
Run;
![Page 28: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/28.jpg)
Conclusion
Creating binary and decimal variables from a series of indicator variables is useful
– Display responses with PROC TABULATE and MULTILABEL format
– A macro program can be used to build the format
Limitation
– Observations where missing responses cannot be considered a “no” response must be removed from the display
– Maximum of about 10 indicators (ie. 2**10-1 combinations)
![Page 29: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/29.jpg)
SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.
Other brand and product names are registered trademarks or Trademarks of their respective companies.
The Power
To Know™
SAS®
![Page 30: A Concise Display of Multiple Response Items Patrick Thornton](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649e265503460f94b15e34/html5/thumbnails/30.jpg)
Contact Information
Patrick Thornton, Ph.D.
333 Ravenswood Ave
Menlo Park, CA 94025-3493
650 859-5583