The missing documentation for EvaluateDerivedIteration

Some of you may have noticed the new feature in PASW Reports for Surveys (nee. Desktop Reporter) which enables you to build new derived grid variables via the UI using the Variables->New Grid menu item. In case you don't appreciate the usefulness of this feature I'll spell it out:

You have data from a source like SPSS SAV File (PASW Statistics File), SAS or Triple-S which doesn't contain grids, it has variables like:

  • Rating_BrandA
  • Rating_BrandB
  • Rating_BrandC

And you wanted to build a table which crosses Rating with Brand (pretty common I hear you say).. in other words you want these variables to look like a grid and you might even want to change your case data at all, you might just want a derived grid variable based on these 3 top level variables.

The ability to actually create a derived grid is not actually new, there's always been a way to do this but the expressions were always a bit complicated to make it happen.

What is it that Reports for Surveys is doing when I create a new grid variable

When you select the variables that you want to place into the grid in Reports for Surveys and tell it to make a new Grid variable what its actually doing in the underlying metadata is something like this (I've intentionally simplified the metadata here for readability):

 NEWGRID "" loop {
Rating_BrandA "BrandA",
Rating_BrandB "BrandB",
Rating_BrandC "BrandC
} fields
(
Rating "how do you rate this brand?" categorical [1]
{ use \\ratingList - } expression ("EvaluateDerivedIteration(LevelID)");
) expand grid;

What's the magic going on here?

There are 2 things to really think about with this bit of metadata:

  1. The category names (category ID's) for the iterator of the grid match the question name of top level question they look up.
  2. The expression EvaluateDerivedIteration(LevelID) is added to the Rating question inside the grid.

So in summary whats the EvaluateDerivedIteration function doing here?

The function is taking the name of the LevelID (e.g. Rating_BrandA) and returning the value of that variable down levelled into the grid level, its a short hand of some much more complicated expressions.

Can I use this in Professional (nee mrStudio) or other programs which access metadata?

The short answer here is yes, although SPSS has chosen not to document this function that doesn't mean the function isn't in the Function Library, it does exist and you can use it, SPSS won't probably support its use, but there are reasons you might want to use it such as:

  • You have flat data and you want grids and you don't want your end users of Reports for Surveys to have to create these grids on their own.
  • You want a lot more control over the Grid you are trying to produce than you could get within the User Interface, for instance you want to change its orientation properties and that kind of thing.
  • You are scripting your tables and you want grids but you don't want to have to set them up in Reports for Surveys UI to use them.

Tips on setting up custom grids using EvaluateDerivedIteration:

  1. The inside variable (e.g. Rating) you are making should have a source type of sExpression
  2. The list should be referenced by the Rating variable or copied in and the noDeriveElements property should be set up (actually we didn't try without it might work anyway)
  3. The categories (iterators) of the grid have to match actual "next level up" question names so that the LevelID can be matched up to a question name.
  4. The mlExpand property has to be set you can't use this function on an unbounded level, the iterator MUST be categorical for it to work.

If you would like more information on adding richness to your data in PASW Data Collection, feel free to contact us at This e-mail address is being protected from spambots. You need JavaScript enabled to view it