Generate SPSS report

Jun 25, 2011 at 3:38 PM
Edited Jun 25, 2011 at 3:38 PM


I have a requirement to provide result table in SPSS format, do you guys know how to generate report like below:


Question1, Select the best one?


2.Coca Cola


Question2, Age Range?

1. 10-15

2. 16 -20

3.20- 25


So in SSP Format it would be like

Response Question1 Question2

R1            3                  2

R2            2                  4

R3            1                  1

my database store data like:

Response Answer QID

1               3        1

1               2        1

2               2        4

3               1        1

How to display it on gridview, table or etc.

Thank, you,


Jul 6, 2011 at 9:13 PM

You can take advantage of SPSS' "variable labels" and "value labels" to write the actual questions and answer text into the file rather than generic names (like Q1 and R1).

If I understand your data store, you will need to use QID to tie into your variable names (you would have to make them up or use Qn) and your answer number would be the value set to that variable in the case. Each case would represent a single respondent.

foreach(row in table) {

if(row.Response > doc.Cases.Count) { doc.Cases.NewCase(); }

doc.Cases[row.Response].SetDBValue("Q"+row.QID.ToString(), row.Answer);