|
I would like to produce a horizontal bar that shows a set of Likert question
responses in a stacked format. Thus, it would show the percentage of code 1 responses for each question, the % of code 2 responses for each question, etc. Tks, WMB Statistical Services ============ mailto: [hidden email] http:\\home.earthlink.net\~info.statman ============ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Will
Statistical Services ============ info.statman@earthlink.net http://home.earthlink.net/~z_statman/ ============ |
|
You want one bar per question?
The simplest way to do this is to use VARSTOCASES so that each case has a response value and an index value for the question. Something like this should work: *create some data. input program. loop #1=1 to 100. do repeat q= q1 to q5. compute q=trunc(uniform(6)). end repeat. end case. end loop. end file. end input program. execute. *transpose vars to cases. VARSTOCASES /ID=id /MAKE question FROM q1 q2 q3 q4 q5 /INDEX=qindex(question) /NULL=KEEP. * make the chart using chart builder. * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=qindex COUNT()[name="COUNT"] question[LEVEL=NOMINAL] MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: qindex=col(source(s), name("qindex"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) DATA: question=col(source(s), name("question"), unit.category()) COORD: rect(dim(1,2), transpose()) GUIDE: axis(dim(1), label("qindex")) GUIDE: axis(dim(2), label("Percent")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("question")) SCALE: linear(dim(2), include(0)) ELEMENT: interval.stack(position(summary.percent(qindex*COUNT, base.coordinate(dim(1)))), color.interior(question), shape.interior(shape.square)) END GPL. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Statmanz Sent: Monday, December 15, 2008 6:59 AM To: [hidden email] Subject: Plot of Likert Questions by Scale I would like to produce a horizontal bar that shows a set of Likert question responses in a stacked format. Thus, it would show the percentage of code 1 responses for each question, the % of code 2 responses for each question, etc. Tks, WMB Statistical Services ============ mailto: [hidden email] http:\\home.earthlink.net\~info.statman ============ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Thanks ViAnn, after flipping the bar and some cosmetic editing looks good.
W -----Original Message----- From: ViAnn Beadle [mailto:[hidden email]] Sent: Monday, December 15, 2008 9:44 AM To: 'Statmanz'; [hidden email] Subject: RE: Plot of Likert Questions by Scale You want one bar per question? The simplest way to do this is to use VARSTOCASES so that each case has a response value and an index value for the question. Something like this should work: *create some data. input program. loop #1=1 to 100. do repeat q= q1 to q5. compute q=trunc(uniform(6)). end repeat. end case. end loop. end file. end input program. execute. *transpose vars to cases. VARSTOCASES /ID=id /MAKE question FROM q1 q2 q3 q4 q5 /INDEX=qindex(question) /NULL=KEEP. * make the chart using chart builder. * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=qindex COUNT()[name="COUNT"] question[LEVEL=NOMINAL] MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: qindex=col(source(s), name("qindex"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) DATA: question=col(source(s), name("question"), unit.category()) COORD: rect(dim(1,2), transpose()) GUIDE: axis(dim(1), label("qindex")) GUIDE: axis(dim(2), label("Percent")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("question")) SCALE: linear(dim(2), include(0)) ELEMENT: interval.stack(position(summary.percent(qindex*COUNT, base.coordinate(dim(1)))), color.interior(question), shape.interior(shape.square)) END GPL. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Statmanz Sent: Monday, December 15, 2008 6:59 AM To: [hidden email] Subject: Plot of Likert Questions by Scale I would like to produce a horizontal bar that shows a set of Likert question responses in a stacked format. Thus, it would show the percentage of code 1 responses for each question, the % of code 2 responses for each question, etc. Tks, WMB Statistical Services ============ mailto: [hidden email] http:\\home.earthlink.net\~info.statman ============ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Will
Statistical Services ============ info.statman@earthlink.net http://home.earthlink.net/~z_statman/ ============ |
| Free forum by Nabble | Edit this page |
