Using Stata
Getting started- Some useful commands
- search = returns the list of commands associated with the specific topic you have entered.
- help topic = returns the help file for a specific topic you have entered
- clear removes the dataset that is currently loaded in memory so that you can import a new dataset
Basic commands in Stata
- Descriptive Statistics: Use “summarize” or “sum” for short.
- List Observations: “list in ⅕” (lists the first 5 observations)
- Generate a New Variable: “generate new_var = expression”
- Rename a Variable: “rename old_var new_var”
- Drop a Variable: “drop var_nam"
Data Management in Stata
- Sort Data: “sort var_name”
- Keep Specific Observations:” keep if condition”
- Drop Specific Observations: “drop if condition”
- Merge Datasets: ‘merge 1:1 id_var using "path/to/secondfile.dta"’
Basic Analysis in Stata
- Regression: “regress y_var x_var”
- Tabulations: “tabulate var_name”
- Correlations: “correlate var1 var2”
Graphics in Stata
- Histogram: “histogram var_name”
- Scatter plot: “scatter y_var x_var”
Accessing Stata on Parallels
- Navigate to your Parallels Workspace portal
- After logging in, you will see a list of available applications.
- Locate the Stata icon in the list of applications.
- Click on the Stata icon to launch the application. Stata should open in a new window or tab, ready for you to start using it.
Uploading Data to Parallels transfer files between local and Parallels Client virtual desktop:
- Look for an option within the Parallels interface called "File Access" or "Transfer Files"
- Choose the file you want to upload from your local machine to the Parallels client virtual desktop
- Once the file is uploaded, you can access it within Stata for analysis
Importing Data within Parallels:
- Click on the “File” menu -> “Import Data”
- Choose the appropriate format (e.g, Excel, CSV)
- Navigate to the location of your uploaded file and select it.
- Follow the on-screen prompts to complete the import
- Using Command (for a CSV file as an example): “Import delimited “path/to/your/uploaded/file.csv”
Saving Data within Parallels:
Once you complete your work or ready to go, save your work within Parallels either using the Stata GUI or commands:
- Using the GUI: Click on the “File” menu --> “Save As” Choose a location and name for your file
- Using Command: “Save path/to/savefile.dta, replace”;
Downloading Data from Parallels:
To transfer the Stata file (or any other file) from Parallels to your local machine: Navigate “File Access” or “Transfer Files” Select the file you want to download and follow the on-screen prompts Existing Stata and Parallels Workspace Close Stata as you normally would and make sure to log out from your Parallels workspace.
Learn more about Stata:
The University of Toronto provides Stata information, tutorials, and workshops for students at all levels.