spss

Strip suffix from all variable names in SPSS

人盡茶涼 提交于 2019-12-07 10:25:17
问题 I have a dataset in which every variable name has the suffix "_1" (this was done to indicate the first interview timepoint). I want to remove this suffix from all variables, but there are hundreds of them, so I am looking for a way to do it without using the RENAME statement hundreds of times. The closest to relevant info I found was from the link below, "A few SPSS loops for renaming variables dynamically." However, these examples show how to add a suffix or change a prefix, but not remove a

Importing SPSS dataset into Python

爱⌒轻易说出口 提交于 2019-12-07 02:42:49
问题 Is there any way to import SPSS dataset into Python, preferably NumPy recarray format? I have looked around but could not find any answer. Joon 回答1: Maybe this will help: Python reader + writer for spss sav files (Linux, Mac & Windows) http://code.activestate.com/recipes/577811-python-reader-writer-for-spss-sav-files-linux-mac-/ 回答2: SPSS has an extensive integration with Python, but that is meant to be used with SPSS (now known as IBM SPSS Statistics). There is an SPSS ODBC driver that could

Reading Centroid extracted factor matrix into SPSS for rotation, analysis

眉间皱痕 提交于 2019-12-06 14:53:15
This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 3 years ago . UPDATE: 4/28 I found the proper syntax to import my centriod factor extraction into SPSS and rotate it. Because of limitations in SPSS on what subcommands can be used when reading a matrix in via MATRIX IN (...), I still need to find a way to get the FSCORE and save the new variable (/SAVE REG(ALL) ), but that is another post. What I believe to be the correct syntax is below, along with the proper setup of the matrix. Please correct me if I'm wrong! ORIGINAL POST: I've been

From SQL to SPSS

半腔热情 提交于 2019-12-06 12:31:26
问题 I need to export some data and then I have to export them in a SPSS file format. I've already found out that I need a SPSS SDK. I also have found out that i need a I/O DLL for creating and reading these files. But I cannot find them. Can anybody please send me the direct link, as it seems that I'm too dumb to find it. Please help! Thanks in advance PS: I just need to create some SPPS files and I don't have any SPSS licence. EDIT: it'a an webapplication on the internet, and the client wants us

Export R data.frame to SPSS

这一生的挚爱 提交于 2019-12-06 06:27:05
问题 There is a package foreign with a function write.foreign() that can write a SPS and CSV file. The SPS file than can read the CSV fiel into SPSS including labels. Fine so far, but there are some issues with that function: Newer SPSS versions may show an error that you have too few format definitions in DATA LIST If there are "labels" for numeric variables stored via attr() , these are lost. Even if the SPSS vesion supports strings up to 32767, the function write.foreign() stops if there are

How to source a syntax file from another syntax file in SPSS?

☆樱花仙子☆ 提交于 2019-12-06 03:11:45
In R there is the source function where you can source an R script from another R script. I want to be able to do the same in SPSS. How can I source an SPSS syntax file from another SPSS syntax file? Updated Following @AndyW's comments. There is the INSERT and INCLUDE commands. INSERT is newer and more versatile than INCLUDE . See documentation on INSERT here . The following is the basic syntax template: INSERT FILE='file specification' [SYNTAX = {INTERACTIVE*}] {BATCH } [ERROR = {CONTINUE*}] {STOP } [CD = {NO*}] {YES} [ENCODING = 'encoding specification'] Thus, the following command can be

Quickly import custom SPSS commands from Python

萝らか妹 提交于 2019-12-05 19:21:43
I have written a neat Python module that contains some custom SPSS functions for my coworkers to use. However, to use the functionality, they first need to type BEGIN PROGRAM. Import module etc... before actually calling the function. Because most of them aren't tech savvy, I'm looking to make things easier. Now they have to type something like this: BEGIN PROGRAM. import sys sys.path.append("C:/Python scripts") import mymodule mymodule.custom_function('a','c') END PROGRAM. Is there a way I can write some SPSS-macro that will call the functions from my Python module in a single line? Like this

Importing SPSS dataset into Python

喜欢而已 提交于 2019-12-05 07:24:01
Is there any way to import SPSS dataset into Python, preferably NumPy recarray format? I have looked around but could not find any answer. Joon Maybe this will help: Python reader + writer for spss sav files (Linux, Mac & Windows) http://code.activestate.com/recipes/577811-python-reader-writer-for-spss-sav-files-linux-mac-/ SPSS has an extensive integration with Python, but that is meant to be used with SPSS (now known as IBM SPSS Statistics). There is an SPSS ODBC driver that could be used with Python ODBC support to read a sav file. Option 1 As rkbarney pointed out, there is the Python

Is it possible to automatically repair corrupt Excel workbooks?

拥有回忆 提交于 2019-12-05 07:08:51
I am using SPSS 15 to create several Excel reports which I am then consolidating using an Excel macro. Unfortunately that particular SPSS version produces .xls files that aren't easily readable for Excel 2007 and up. Excel 2003 gobbles those files up just fine, but newer Excel versions display two error messages. First up is "Excel found unreadable content in filename.xls. Do you want to recover the contents of this workbook?". After clicking yes this is followed by "File Error: data may have been lost". Unfortunately these error messages cause my macro to quit at the first file with error

How to preserve Labels when SPSS file (.sav) imported into pandas via rpy?

眉间皱痕 提交于 2019-12-05 03:24:05
I'm looking to work on a SPSS files (.sav) using pandas . In the absence of the SPSS program, here's what a typical file looks like when converted to .csv: On investigation into what the first two rows signify (I don't know SPSS), it seems that the first row contains the Label s, while the second row contains the VarName s. When I bring the file into pandas thus: import pandas.rpy.common as com def savtocsv(filename): w = com.robj.r('foreign::read.spss("%s", to.data.frame=TRUE)' % filename) w = com.convert_robj(w) return w and then do a head(), the first row (Label) is missing: How can labels