Learn Tables : Numerical & Text

In the previous article we looked at how to tabulate categorical questions, in this article we will take our previous script and look at how we can tabulate numerical and text questions.

So first off we will take our old script and a new table,

oTableDoc.Tables.AddNew("Table6", "visits{'Mean' mean(visits), " + _
					  'Min' min(visits), " + _
					  'Max' max(visits), " + _
					  'stddev' stddev(visits)}", "Table6")
Mean , Min , Max & StdDev

In this table we have taken the Visits question and done a Mean,Min,Max and standard deviation of it. if you look at the syntax used you will see that the required calculations are grouped in curly braces and separated by a comma.

 QuestionName{ ..A.. , ..B.. , ..C.. , ..D.. }

and each calculation can be broken down into two sections

'TITLE' Calculation(VariableName)

first off we have the words that we want to see in the table next to the result of the calculation and then we have the calculation its self so for us that was,

'Mean' mean(visits), 'Min' min(visits),'Max' max(visits),'stddev' stddev(visits)

So that was one common way of tabulating a numeric question, another is to group the answers into bands. This can be done with the expression command as shown,

oTableDoc.Tables.AddNew("Table7", "adults{base(), _2 '2' expression('adults = 2'), " + _
                                                 "_3To4 '3 - 4' expression('adults >= 3 AND adults <= 4'), " + _
                                                 "_5To6 '5 - 6' expression('adults >= 5 AND adults <= 6'), " + _
                                                 "_7To8 '7 - 8' expression('adults >= 7 AND adults <= 8'), " + _
                                                 "_9To10 '9 - 10' expression('adults >= 9 AND adults <= 10')}", "Table7")
Bands

if we take a look at this syntax we can see that the we have the same main structure

 QuestionName{ ..A.. , ..B.. , ..C.. , ..D.. }

and again each calculation can be broken down into sections

id 'TITLE' expression('expression logic')

so for each band we have created a type of filter to count the responses that have answered the adults question with a number equal to two, and then its followed by any answer between and including 3 & 4 and so on. So that was a quick guide to tabulate numerical questions. Next we will look at how you can show the answers to our text questions in our reports. So for our next table add the following

.
oTableDoc.Tables.AddNewProfile("Table8", "profile({gender, name})", "Table8")

As you will see this time we have not used the add table command , but the addnewprofile command. This command allows us to add text questions into our table. It does not do anything fancy , it just allows us to see each respondents answer to the text questions.

Text Questions

You should notice from the image that a number get assigned to each row. This is not the respondent.serial number it is just a sequential number that gets added to the report. So now we have shown you how to tabulate Categorical , numerical and see your text questions in you tables. In our next article we will show you how to filter your tables at the global level, so a filter that effects all tables and a filter at the table level that only effects the table that you are creating.

Leave a Comment

%d bloggers like this: