How to Upload Data Set Into Stata
This article is part of the Stata for Students serial. If you are new to Stata we strongly recommend reading all the manufactures in the Stata Nuts section.
This article volition teach you how to download data from a survey you've created using Qualtrics and import it into Stata. We'll presume you've already learned to use Qualtrics, created a survey, and nerveless data using information technology.
Downloading the Data
Begin past logging into Qualtrics, and opening your survey. Then go to Information & Assay, click the Export & Import button, and cull Export Data...
Choose CSV, select Use numeric values and then Download. A CSV, or Comma-Separated Values file, is a text file containing information with i observation per line and a comma betwixt each value. Many computers care for CSV files similar Excel files, but they're actually only text.
Note: for work that is not a class assignment information technology's usually easier to download an SPSS file and catechumen it to Stata format using Stat/Transfer, equally it will come with variable and value labels already defined. If your instructor told you to download a CSV file (equally is typical in Soc 357) it's to requite you an opportunity to practice preparing a data set.
Qualtrics will requite you lot a zip file containing the CSV file you actually want to work with. Usually if y'all tell your browser to open the null file yous'll be able to run across the CSV file.
Y'all'll demand to put the file in a permanent location, most likely wherever you commonly put files associated with your course. On the SSCC network, the U: bulldoze is a good choice. Ane way to do that is to right click on the file, choose Copy, get to the permanent location, and choose Paste.
Create a do file in that location and double-click on it to starting time Stata. Have your do file create a log file and fix the Stata environment as usual. When it comes fourth dimension to load your data, yous'll need to import it, and Qualtrics files need a bit of special attention.
Importing the Data
The easy way to import a CSV file is to click File, Import, Text Information. This volition open an import window with the various settings you tin can choose and a preview of how the data will exist interpreted with the electric current settings. Thus you tin can tweak the settings until the preview makes sense and then click OK to really import the information. Just be certain to re-create the resulting control into your do file and then you lot don't accept to get through that procedure every fourth dimension. You'll start with something similar the following:
The CSV file Qualtrics gives y'all contains some variables you almost certainly don't intendance about, like the date and time the respondent started the survey, and some rows that don't actually represent observations. Instead they contain "metadata" or data virtually the data. Almost of that metadata cannot be used by Stata, and if you tell Stata to care for those rows equally observations information technology will be very confused. The key to importing Qualtrics data into Stata is to use the Fix range button to only import the part of the information that y'all desire and can use.
Ringlet correct until you detect the actual questions in your survey. In this instance, they start in column 18:
Note how the actual responses brainstorm in row five. Now y'all're ready to click Set range:
Under Rows, check First and fix it to v. Under Columns bank check First and set information technology to 18 (or the corresponding numbers for your data set up). When y'all click OK, the preview window volition look quite unlike:
With the metadata rows gone, Stata should recognize that the file contains variable names (q1, q2, etc.) and utilize them automatically. It volition also recognize that the variables are numeric rather than text, so they'll be blackness instead of red. Click OK and you'll get a usable data set. Exist sure to re-create the control Stata runs into your practise file then that in the future this whole process will happen automatically. It will look something like:
import delimited "U:\357\357 Example_March 7, 2018_09.38.csv", rowrange(v) colrange(18)
Preparing the Data
While the resulting information set can be used as-is, the variable names are not very informative, and variable and value labels would be very helpful (and possibly required for your class). Variable labels can but be fourscore characters long, and then you may demand to abbreviate your questions. Yous may also want to create indicator variables for yes/no questions rather than using Qualtrics'due south default one/2 coding. Instructions for doing all these things can be found in Stata for Students: Creating Variables and Labels. We won't repeat them here, just the following do file is an example of their use. You lot may need to refer to your survey in Qualtrics to go details almost the questions and possible responses.
capture log close
log using prepdata.log, replace
articulate all
fix more off
import delimited "U:\357\357 Example_March 7, 2018_09.38.csv", rowrange(5) colrange(18)
rename q1 difficult
label variable difficult "Using Stata for assignments in this class was difficult for me."
label define agree 1 "Strongly Agree" 2 "Somewhat Agree" 3 "Neither Agree Nor Disagree" 4 "Somewhat Disagree" 5 "Strongly Disagree"
label values difficult agree
gen everProgram=(q2==1) if q2<.
characterization variable everProgram "Earlier this course, had you ever written a computer program?"
gen class=(q3==one) if q3<.
label variable class "Before this class, had you ever taken a programming course (HS or College)?"
gen taught=(q4==one) if q4<.
label variable taught "Were you ever taught to program before loftier school?"
label define yn 1 "Aye" 0 "No"
characterization values everProgram class taught yn
drop q2 q3 q4
rename q5 device
label variable device "What kind computing device have you lot spent the near time using?"
rename q7 entDevice //Note how the variables were not numbered sequentially by Qualtrics. Sentry for that.
characterization variable entDevice "What kind computing device have you spent the most time using for entertainment?"
label ascertain device 1 "Windows Computer" two "Apple Computer" 3 "Smartphone or Tablet" 4 "Gaming Console" five "Other Device / Does not employ"
characterization values device entDevice device
save projectdata, replace
log close
Last Revised: 3/8/2018
Source: https://www.ssc.wisc.edu/sscc/pubs/sfs/sfs-qualtrics.htm
Posting Komentar untuk "How to Upload Data Set Into Stata"