spss


Loop through items and sum items in SPSS

断了今生、忘了曾经 提交于 2020-01-25 11:23:12
问题 I have two sets of variables called ITEM 1 to ITEM 47, and another called L1 to L47. What I want to do is to calculate the sum of Ls if any ITEM#i=1. What I wrote is as following: COMPUTE LSUM=0. LOOP #i=1 to 47. IF (ITEM(#i)=1) LSUM=LSUM+L(#i). END LOOP. But I got an error message saying the characters do not match any existing function or vector. What should I do then? Your inputs will be very appreciated. Thanks. Sincerely, Lucy 回答1: COMPUTE LSUM=0. exe. vector vitems = ITEM 1 to ITEM 47.

Dynamically create value labels with haven::labelled

可紊 提交于 2020-01-24 23:42:07
问题 I am using haven::labelled to set value labels of a variable. The goal is to create a fully documented dataset I can export to SPSS. Now, say I have a df value_labels of values and their value labels. I also have i df df_data with variables to which I want allocate value labels. value_labels <- tibble( value = 1:6, labels = paste0("value", 1:6) ) df_data <- tibble( id = 1:10, var = floor(runif(10, 1, 6)) ) Manually, I would create value labels for df_data$var like so: df_data$var <- haven:

Saving data from SPSS to Excel - custom sheet name

删除回忆录丶 提交于 2020-01-24 19:06:31
问题 Is it possible, When exporting a dataset from SPSS to Excel, to control the name of the worksheet the data is being saved into ? The "SAVE TRANSLATE OUTFILE" command does not allow for this. I have SPSS 21, with Python installed (although I am fairly new to Python...) 回答1: Yes. See this weblink on IBM website for details. get file="C:\Program Files\IBM\SPSS\Statistics\23\Samples\English\Employee data.sav". SAVE TRANSLATE /TYPE=ODBC /CONNECT='DSN=Excel Files;DBQ=C:\Daten\Temp

Query SQL Server from SPSS how to connect

余生长醉 提交于 2020-01-16 09:35:50
问题 I am at a total loss on how to do what I think is a fairly simple and standard task: I am running SPSS 20 on Mac and want to connect to a SQL Server database on a remote server. When going to File -> Open Database -> New Query (The command names may be a bit off, my SPSS is in German and I'm just translating) it only shows myodbc as data source. I assume I have to add a driver for SQL Server however I don´t really know where to get it or how to install it as I cannot find it in the SPSS

How can I read in multiple excel files in SPSS using a macro?

会有一股神秘感。 提交于 2020-01-15 05:28:29
问题 I'm trying to write a Macro to import 15 files, all in the same format. The name format is the "monyy PSF Extract". So I can use the code below to read in the 1 file for Nov11. I've tried to find a way of using the macro to read in also the other 14 files. I can't seem to make it work. I'm new to SPSS - I knew how to do this in SAS. I also want to set the dataset created to be named monyy. I will also want to rename some variables as original_name_monyy. Can someone help me on this please?It

SPSS Macro to Automate Sequential Variable References

霸气de小男生 提交于 2020-01-15 04:34:26
问题 I've had a tough time getting a simple loop to work in SPSS that isn't based on variables. In a nutshell, I want to write !sequentialVars varStr=/Var/ i=/20/. or similar and get: Var1 Var2 Var3 Var4 Var5 ... Var19 Var20 to put into a cTable or anywhere else that takes a string of variable names. In pseudo VB it would be: varString = "AnyVarName" for i=1 to 20 newVarList = concatenate(newVarList," ",varString, i) next i I can't even echo back the i in an SPSS loop, let alone concatenate it.

SPSS Macro to Automate Sequential Variable References

孤人 提交于 2020-01-15 04:33:48
问题 I've had a tough time getting a simple loop to work in SPSS that isn't based on variables. In a nutshell, I want to write !sequentialVars varStr=/Var/ i=/20/. or similar and get: Var1 Var2 Var3 Var4 Var5 ... Var19 Var20 to put into a cTable or anywhere else that takes a string of variable names. In pseudo VB it would be: varString = "AnyVarName" for i=1 to 20 newVarList = concatenate(newVarList," ",varString, i) next i I can't even echo back the i in an SPSS loop, let alone concatenate it.

Repeated measures ANOVA - different resutls for SPSS versus R

浪子不回头ぞ 提交于 2020-01-06 02:32:08
问题 I am trying to run a repeated - measures ANOVA using R and compared it to the SPSS output and results differ a lot! Maybe I make a mistake somewhere, but I cannot figure it out So some sample data: id is the subject. Every subject makes one rating for three items (res_1, res_2 and res_3). I want to compare an overall effect of item. id<-c(1,2,3,4,5,6) res_1<-c(1,1,1,2,2,1) res_2<-c(4,5,2,4,4,3) res_3<-c(4,5,6,3,6,6) ## wide format for spss table<-as.data.frame(cbind(id, res_1, res_2, res_3))

How do I export a SQL query into SPSS?

跟風遠走 提交于 2020-01-01 16:08:05
问题 I have this monster query written in T-SQL that pulls together and crunches data from multiple tables. I can export the result to CSV or Excel easily enough, but would like to send it right into SPSS. The ODBC drivers in SPSS only recognize Tables and Views in my SQL database. Any ideas how to get the results of my query into SPSS? Options: Export to Excel then import to SPSS... formatting things like dates become unwieldy Save query as a table in my database... but then I would have to make

How can I loop through variables in SPSS? I want to avoid code duplication

余生颓废 提交于 2019-12-30 05:11:08
问题 Is there a "native" SPSS way to loop through some variable names? All I want to do is take a list of variables (that I define) and run the same procedure for them: pseudo-code - not really a good example, but gets the point across... for i in varlist['a','b','c'] do FREQUENCIES VARIABLES=varlist[i] / ORDER=ANALYSIS. end I've noticed that people seem to just use R or Python SPSS plugins to achieve this basic array functionality, but I don't know how soon I can get those configured (if ever) on

工具导航Map