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

Perl Regex syntax

早过忘川 提交于 2019-12-25 00:40:30
问题 I would like to use Perl to take a previously generated SPSS syntax file and format it for use in an R environment. This is probably a very simple task for those familiar with Perl and regex, but I am stumbling. The steps as I've laid them out for this Perl script are as follows: Read in SPSS file Find appropriate chunks of SPSS file (regex) for further processing and formatting Further processing noted above (more regex) Return R syntax to command line or preferably a file. The basic format

What does it need to specify the category order in a colored and patterned pie chart in SPSS?

六眼飞鱼酱① 提交于 2019-12-24 23:23:49
问题 I created a colored and patterned pie chart as described in this stack exchange Question. Now I also want to specify an order of the categories to apear in the pie chart. Usually this works with the sort.values funtion: SCALE: cat(aesthetic(aesthetic.color), sort.values("value", "value",...)) However this function doesn't seem to have an effect when having both color(var)) and texture.pattern(var) functions inside the same ELEMENT -Statement. 回答1: You also need to specify the category order

Scale-building in SPSS

房东的猫 提交于 2019-12-24 20:15:02
问题 I'm using Cronbach's alpha to analyze data in order to build/refine a scale. This is a tedious process in SPSS, since it doesn't automatically optimize the scale, so I'm hoping there is a way to use syntax to speed it up. So I start with a set of items, set up the OMS control panel to capture the item-total statistics table, and the run the alpha analysis. This pushes the item-total stats into a new dataset. Then I check the alpha value, and use it in syntax to screen out items that have a

How to batch process converting all .sav to flat file that are in a folder in R ?

你。 提交于 2019-12-24 19:43:23
问题 Below is my code to convert .sav to a flat file format that works well, my issue raises when I have more than 50 files. Any suggestions on how I can process all the files available in a folder in a loop ? #load library foreign to read spss library(foreign) #set working directory first setwd("M:\\Files\\Linear Reg") #read .sav file data <-read.spss('Computed_Copy.sav', to.data.frame=TRUE,use.value.labels=FALSE) write.csv(data, "Computed_Copy.csv") 回答1: First list all files in your folder with