Previous Next

Generating .do file templates

See Using Stata for details on how to generate Stata .do file templates for your SurveyCTO forms. These templates import, merge, and label your data, using your form definition as a guide. They help you to get quickly up-and-running with Stata.

Automatically running your .do files

You can configure SurveyCTO Desktop to automatically run your .do files whenever you export new data. Just do the following:

  1. Create a subdirectory named thenrun within your chosen destination directory for Desktop exports. (This should be the directory you choose for the data destination when you sync data in Desktop, and it should match the CSV directory you choose when generating your .do file templates.)
  2. Save your .do files in that thenrun subdirectory.
  3. Configure Desktop to Auto-run other processors after export in its Export options. (See How do I automatically execute processes when new data becomes available? for more details.)

Whenever you export new data into the destination directory with the thenrun subdirectory, your .do files (and anything else in that thenrun subdirectory) will be run.

Are your .do files opening rather than executing?
If your .do files open in the .do file editor instead of executing, you'll need to update one of your Stata settings. On Windows, open the .do file editor, choose the Edit... Preferences menu option, and uncheck the "Edit do-files opened from Windows instead of executing them" option in the Advanced section or tab. On MacOS, choose the global Preferences... General preferences menu option, the Windows tab, and the Do-file Editor window, then un-check the "Edit do-files opened from the Finder in Do-file Editor" option in the Advanced sub-tab.
Previous Next