Smart_RDG Examples

The command “!Smart_RDG” provides functionality to generate data for questions that have a relationship of some type when using the “RDG” command in Survent. It attempts to fill the criteria for X times and then forces an answer that meets the criteria if it hasn’t already. This makes it much easier to test surveys with grids or complex logic.

See theDocumentations Sitefor more information.

The syntax of a Smart_RDG statement is:

 {!Smart_RDG Keyword(<Value>,Question List) <TRIES=##> }{!Smart_RDG Keyword(Question List)=Value <TRIES=##> }{!Smart_RDG FREE }

Where “Keyword” is a check commonly used in Survent.

For example, CONSTANT_SUM checks that multiple !NUM questions equal a specific number.

“Question List” is the list of question labels which will be used.

There is a 50 label limit, but asterisks (*) can be used as a wildcard to refer to questions with like-named labels.

“TRIES” is the number of random attempts to make. If TRIES is not specified, SmartRDG immediately generates the data to match the keyword criteria.

“FREE” disables or resets previous !Smart_RDG statements.

Here are the Keywords:

CONSTANT_SUM: Checks that a group of numeric questions add up to a certain value.

Syntax: !Smart_RDG CONSTANT_SUM(Question List)=<Label or ###> TRIES=###Example: !Smart_RDG CONSTANT_SUM(Q1,Q2,Q3)=100 TRIES=10!Smart_RDG CONSTANT_SUM(Q1,Q2,Q3)=TOTAL TRIES=10

After the specified number of TRIES using random filling of the questions, it will force these !NUMs to add to value assigned. Notice the value to assign can be either a specific number or a previous question label.

RANK: Checks that a unique rank or code is assigned across all available !FIELD or !NUMERIC questions. If there are duplicates or the values are not ordered from 1 to N it will be an error and have to try again.

Syntax:!Smart_RDG RANK(Question List) TRIES=##Example:!Smart_RDG RANK(Q1,Q2,Q3) TRIES=10

The above tries to get unique values randomly, then after # tries it supplies a unique set of values. For numeric variables, it assigns values starting with 1 and increasing by 1. If used with a !FIELD code list it supplies a unique code for each.

RANKTOP: This is the same as RANK but allows some values to be blank. It is used for rank questions with a limited number of ranks out of a set (eg. top 3, bottom 3, etc.)

Syntax:!Smart_RDG RANKTOP(<# to rank>,<Question List>), TRIES=##Example:!Smart_RDG RANKTOP(3,Q1,Q2,Q3,Q4,Q5), TRIES=5

Will randomly insert unique responses between 1 and the # TO RANK across the !NUMERIC or !FIELD questions in QUESTION LIST, and leave others blank. Questions or grids must use subtype BLANK_OK to allow for blanks in data.

RANK_WITH_DONT_KNOW: This will force unique rankings for each question, but also allows for an non-unique exception code. This function assumes the last response item in the response table in the exception, unless “Don’t Know Other Response” (DKOR) is specified:

Syntax:!Smart_RDG RANK_WITH_DONT_KNOW(Question List) <DKOR=xx> TRIES=##Examples:!Smart_RDG RANK_WITH_DONT_KNOW(Q1,Q2,Q3,Q4) TRIES=5!Smart_RDG RANK_WITH_DONT_KNOW(Q1,Q2,Q3,Q4), DKOR=99, TRIES=10}

This supplies a unique rank for each question in the QUESTION LIST, but also allows one non-unique exception code for the last response item in the !FIELD.

ONLY_ANSWER: This causes RDG to enter a specific answer for all specified questions.

Syntax:!Smart_RDG ONLY_ANSWER(Answer,Question List) TRIES=##)Example:!Smart_RDG ONLY_ANSWER(01,Q5,Q7) TRIES=5)

The answer can be a number or a response code.

OTHER: Generate a response that meets the Other Specify criteria in a !FIELD question. When used, this will always select the other response code as an answer choice, so ‘checktext’ backends are always met.

Syntax:!Smart_RDG OTHER(Question Label), OTHER_RESP=x, TRIES=#Example:!Smart_RDG OTHER(Q1), OTHER_RESP=99, TRIES=5

Since RDG will always fill a !VARIABLE or !TEXT question with data unless it has a condition, this function will also always select the other response code, so back-end checks that enforce the !FIELD to !VARIABLE/!TEXT relationship are met.