Example on how to run RDG data

The attached spec RDG_QUOTACHECKS.QPX is an example that shows how to set up Random Data Generation (RDG) to check both data and quotas.

You will want to build a dummy quota cell called RDG_QUOTA_CHK (or any other name you like) to control what the RDG run is going to do. If RDG_QUOTA_CHK is less than the DEFINE of NUMDATAINTS the program will do data checking.


After that many interviews have been collected, the program will automatically switch to doing quota checking. You can also change the quota value in SURVSUPR or QUOTAMOD to force quota checking.

If you are checking data, you will want to skip over the quota checking that is done at the top of the interview.

If you are doing quota checking you will want to skip over the main body of the questionnaire.

Be sure to change the following DEFINE to the number of data interviews you want to create before switching to quota checking.

>DEFINE @NUMDATAINTS 9999>PURGESAME~PREP COMPILE NOSPECS[RDG_CHECKQUOTAS,80,""]{!COMMENT ****The following question is only needed if you are doing column-free mode If you are using column specific you can just have the GEN,As below gen into a specific column.  This column/question will be the flag in the interview to let you know what type of RDG checking is being done.  This will mark the data so you can easily identify what kind of RDG was done to create that data record and it will also allow for a simple if condition if you need to have mulitple skips at various parts of the interview. }{ RDG:   HIDE!FIELD1 CHECK DATA ONLY2 CHECK QUOTAS ONLY }{!COMMENT ****Next two gens add a 1 punch into RDG question if doing data checking or add a 2 punch if doing quota checking. }{!IF DATAGEN() AND QUOTA(RDG_QUOTA_CHK) < @NUMDATAINTS!GENERATE,ADD_CODE,RDG,1 }{!IF DATAGEN() AND QUOTA(RDG_QUOTA_CHK) >= @NUMDATAINTS!GENERATE,ADD_CODE,RDG,2 }{!COMMENT **** Collect all the information you need to do quota checking. }{ SEX:ENTER SEX OF RESPONDENT!FIELD1 MALE2 FEMALE }{!COMMENT ****Now, skip over quota checks if doing data checking. This will allow you to collect as many interviews in each quota cell as you want without ever going over quota. }{!IF RDG(1)!GOTO,STARTQ }{!COMMENT **** Here is where quotas are checked. }{!IF ((SEX(1) AND QUOTA(MALES) >= 10) OR (SEX(2) AND QUOTA(FEMALES) >= 15))!GOTO,OVERQUO }{ !COMMENT **** Skip to end of questionnaire if only doing quota checking. }{!IF RDG(2)!GOTO,QUOTAINC }{!COMMENT **** Next set of questions represent the actual questionnaire. }{ STARTQ:THIS IS START OF REAL QUESTIONNAIRE!DISPLAY }>REPEAT $A=01,...,10{ QN$A:THIS IS QUESTION $A!FIELD01 ONE02 TWO03 THREE04 FOUR }>ENDREPEAT{ CLOSE:Thank you for your time!DISPLAY }{!COMMENT ****If doing data checking you may want to skip quota increments or still do them so you can run freqs to compare data versus quota values. }{!IF RDG(1)!GOTO,DONE }{!COMMENT **** This is quota increment section. }{ QUOTAINC: !GOTO }{!IF SEX(1)!QUOTA,MALES,REGULAR }{!IF SEX(2)!QUOTA,FEMALES,REGULAR }{!GOTO, DONE }{!COMMENT **** Here is section that deals with over quotas. }{ OVERQUO: !GOTO }{!QUOTA,OVER_SEX,REGULAR,NOW }{!SPECIAL,ABORT_INTERVIEW }{!COMMENT  End of survey }{ DONE: !GOTO }{!COMMENT **** Increment the dummy quota. }{!QUOTA,RDG_QUOTA_CHK,REGULAR } ~END

  • rdg_checkquotas.qpx