My Stata do-file template is not working! What do I do?

SurveyCTO supports Stata data analysis software through providing users with a do-file script for Stata, aimed at helping Stata users get started with data cleaning and analysis a bit faster. SurveyCTO’s Stata do-file template will import, format, label and clean your data. Click on the link above for details. There is some scope for SurveyCTO’s do-file template to not work perfectly out of the box due to some of Stata’s requirements and the do-file templates assumptions, or because of certain form design choices and in some cases, some issues to do with how data was exported. Read on for the most common do-file template troubleshooting solutions.

Before we proceed with this article, we need to put forward a minor disclaimer: this guide is aimed at helping SurveyCTO users get the do-file as generated by SurveyCTO working with their raw data, also exported by SurveyCTO. We do not support Stata beyond this. Stata is a product of StataCorp who support their own product. StataCorp offer free technical support to registered owners of Stata. The answers to Stata-related questions might also be readily available online on Statalist, the official Stata user forum, or elsewhere.

Try starting from a new Stata dataset

Firstly, to maybe save you some reading, if you have run your SurveyCTO do-file before and it worked but now you see missing values in Stata, it could be worth regenerating your Stata .dta file from scratch. SurveyCTO’s do-file template will append new rows of data to an existing .dta that it can find and failing that, it will create a new .dta file from your raw CSV data. Regenerating your .dta file can resolve problems like data type discrepancies in Stata which sometimes result in missing data, for example. Discrepancies might be caused by updates you make to your form while collecting data (see below). So either move your .dta file to a new location in your file system (if you want to keep it) or delete it and run your do-file again.

Check your data in Stata. Is data still missing? If yes, don’t worry, continue reading.

The problem might be in your data, not with Stata

If data is missing in Stata after importing it using SurveyCTO’s do-file, the problem might be either that data is missing from the data that is being imported into Stata in the first place (so it was never there to begin with), or one of the steps in the do-file resulted in values going missing. The first thing to check would be whether the values are there in the raw CSV data in the first place. Viewing raw CSV data is best done using software that won’t transform or format it. Our recommendation would be a text editor (like Notepad) but you could also use Excel or Google Sheets (note that Excel and Google Sheets can still automatically format values). While data isn’t displayed in easily readable columns when viewed as text, it should 

0 Comments

Article is closed for comments.