The process of executing an SPSS command in Stata involves converting the syntax of the SPSS command into Stata’s language, followed by running the converted command in the Stata program. This allows users to perform the same function or analysis in Stata as they would in SPSS, using the appropriate Stata syntax. This method enables users to utilize the features and capabilities of both software programs and achieve consistent results.
How do I do this SPSS command in Stata? | Stata FAQ
Say that you use SPSS but wish to know how to do a particular command in
Stata. For example, you want to make a new variable and know you can use the compute command to
create a new variable in SPSS, but what is the equivalent (or similar) command
in Stata? (By the way, there are actually three similar Stata commands,
generate, replace and egen). The table below shows you five
columns of information.
This table is by no means complete, and it not intended to
be a complete and exhaustive reference. Instead, it is intended to be a short,
simple, sweet and handy reference for SPSS users who are making the transition
to Stata. We also highly recommend
A Sample Stata Session
(via the Stata web site) which gives you a quick overview of using Stata as well
as seeing the [GS] Getting Started manual that accompanied your purchase of
Stata.
| SPSS Command | Stata Command(s) | UCLA Web Pages | Stata Manual | Books |
| ADD FILES | append | Combining data | [D] append | ishr – 9.5 |
| AGGREGATE | collapse | Collapsing data across observations | [D] collapse | ishr – 9.6 |
| ANOVA | anova | . | [R] anova | |
| AUTORECODE | destring encode | How can I quickly convert many string variables to numeric | [D] destring [D] encode | |
| CASESTOVARS | reshape wide | Reshaping data from long to wide | [D] reshape | |
| COMMENT | * /* */ // | . | [P] comments | ishr 4.8 |
| COMPUTE | generate replace egen | Creating and Recoding Variables | [D] generate [D] replace [D] egen | ishr 8.1 |
| CORRELATIONS | correlate pwcorr |
– Overview of statistical tests in Stata – Annotated output for the correlation command | [R] correlate | |
| CROSSTABS | tabulate tab2 | Overview of statistical tests in Stata | [R] tabulate twoway | ishr 10.3 |
| DATA LIST | infile infix insheet | Inputting raw data files into Stata | [D] infile (free format) [D] insheet [D] infix (fixed format) | ishr 6.3 |
| DELETE VARIABLES | keep drop | Subsetting variables and observations | [D] drop | |
| DESCRIPTIVES | summarize | – Descriptive information and statistics – Annotated output for the summarize command | [R] summarize | ishr 10.1 |
| DISPLAY | describe | . | [D] describe | |
| DOCUMENT | notes | . | [D] notes | |
| DO IF | xyzcommand if | Stata Learning Module: Using “if” for subsetting with Stata Commands | [U] 11.1.3 if exp | |
| DO REPEAT | foreach | Working across variables using foreach | [P] foreach | ishr – 17.4 |
| ECHO | display | . | [P] display | |
| ERASE | erase | . | [D] erase | |
| EXAMINE | tabulate x, summarize(y) | Overview of statistical tests in Stata | [R] tabulate, summarize() | |
| EXECUTE | no equivalent | comment: transformation commands always immediately executed | none | |
| EXPORT | no equivalent | comment: all Stata files can be used on all platforms | none | |
| FACTOR | factor | Annotated output for the factor command | [MV] factor | |
| FILE LABEL | label data | Labeling data, variables and values | [D] label | |
| FILTER | xyzcommand if (___) | Using “if” for subsetting with Stata Commands | [U] 11.1.3 if exp | |
| FLIP | xpose | . | [D] xpose | |
| FORMATS | format | . | [D] format | ishr – 5.2 |
| FREQUENCIES | tabulate | Overview of statistical tests in Stata | [R] tabulate oneway | ishr – 10.3 |
| GET FILE | use | Using and saving Stata data files | [D] use | ishr – 6.1 |
| GET SAS | fdause | – SAS to Stata – SAS w/formats to Stata | [D] fdause | |
| GRAPH | graph | Introduction to graphics | [G] graph | |
| IF | generate __ if __ | Using “if” for subsetting with Stata Commands | [U] 11.1.3 if exp | ishr – 8.1 |
| IGRAPH | graph | Introduction to graphics | [G] graph | |
| INCLUDE FILE | do ___ | . | [R] do | |
| LIST | list | . | [D] list | |
| LOGISTIC REGRESSION | logistic | Data Analysis Example: Logistic Regression | [R] logistic | |
| LOOP | forvalues | [P] forvalues | ||
| MATCH FILES | merge | Combining Stata data files | [D] merge | ishr – 9.5 |
| MEANS | tabulate __, summarize(__) | Overview of statistical tests in Stata | [R] tabulate, summarize() | ishr – 10.4 |
| MISSING VALUES | none | . | [U] 12.2.1 Missing Values | |
| MIXED | xtmixed | . | [XT] xtmixed | |
| NOMREG | mlogit | Data Analysis Example: Multinomial Logistic Regression | [R] mlogit | |
| PLUM | ologit | Data Analysis Example: Ordinal Logistic Regression | [R] ologit | |
| PROBIT | probit | Data Analysis Example: Probit Regression | [R] probit | |
| RECODE | recode | Creating and Recoding Variables | [D] recode | ishr – 8.4 |
| RECORD TYPE | no equivalent | http://www.stata.com/support/faqs/data/hier.html | ||
| REGRESSION | regress | – Regression with Stata – Annotated output for the regress command | [R] regress | |
| RELIABILITY | alpha | . | [R] alpha | |
| RENAME VARIABLES | rename | . | [D] rename | |
| SAMPLE | sample | . | [D] sample | ishr – 9.2 |
| SAVE | save | Using and saving Stata data files | [D] save | ishr – 6.1 |
| SELECT IF | keep if drop if | Subsetting variables and observations | [D] drop | ishr – 9.2 |
| SORT CASES | sort | . | [D] sort | ishr – 9.4 |
| SPLIT FILE | by | . | [D] by [U] 11 Language syntax | ishr – 4.7 |
| SUMMARIZE | tabulate ___, summarize(___) | Overview of statistical tests in Stata | [R] tabulate, summarize() | |
| TEMPORARY. SELECT IF (___). | xyzcommand if (___) | Using “if” for subsetting with Stata Commands | [U] 11.1.3 if exp | ishr – 4.4 |
| T-TEST | ttest | Overview of statistical tests in Stata | ishr – 10.4 | |
| VALUE LABELS | label values | Labeling data, variables and values | [D] | ishr – 7.1 |
| VARIABLE LABELS | label variable | Labeling data, variables and values | [D] label | ishr – 7.1 |
| VARSTOCASES | reshape long | Reshaping data from wide to long | [D] reshape | |
| WEIGHT | aw pw fw iw | What types of weights do SAS, Stata and SPSS support? | [U] l11.1.6 weight | ishr – 4.5 |
Legend
Cite this article
stats writer (2024). How can I perform this SPSS command in Stata?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-perform-this-spss-command-in-stata/
stats writer. "How can I perform this SPSS command in Stata?." PSYCHOLOGICAL SCALES, 1 Jul. 2024, https://scales.arabpsychology.com/stats/how-can-i-perform-this-spss-command-in-stata/.
stats writer. "How can I perform this SPSS command in Stata?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-perform-this-spss-command-in-stata/.
stats writer (2024) 'How can I perform this SPSS command in Stata?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-perform-this-spss-command-in-stata/.
[1] stats writer, "How can I perform this SPSS command in Stata?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, July, 2024.
stats writer. How can I perform this SPSS command in Stata?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
