0

Hiii all! I have 25 imputed datasets from SAS, and I transferred these datasets into R. I am wondering how to let R recognize my imputed datasets and perform the analysis? Here are some codes I have so far:

df<-read.spss("IFS.sav",use.value.label=TRUE, to.data.frame=TRUE) #worked 

as.mids(long=df,.imp= "X_Imputation_" , .id="survyid" )#doesn't work, it asked me about original dataset. I don't understand why I need that, and i am not sure how to do it. 

with(data=analysis_final, exp=glm(......#this doesn't work. i am wondering how to perform analysis for each imputed dataset and use summary statistics? 
Phil
  • 7,287
  • 3
  • 36
  • 66
  • 1
    You say SAS but your code indicates it's SPSS. Also, we cannot help without having an understanding of your data. – Phil Jul 18 '21 at 01:50
  • i only saw example from spss to sas. So i just converted to sav. What do you mean understanding my data. – Lulu Bai Jul 18 '21 at 01:57
  • I mean this https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Phil Jul 18 '21 at 17:24
  • Please try `haven` package to read in SAS datasets and perform the analysis in R. – YBS Jul 18 '21 at 20:43

1 Answers1

-1

Try:

attach(df)

Or

attach(*your data name values)

Then you will access your variables and you will be able to run summary statistics.

Like:

mean(*variable name)

Or any statistics analyses.

Here is a video that might help you.

Kevin M. Mansour
  • 2,915
  • 6
  • 18
  • 35
  • https://stackoverflow.com/questions/10067680/why-is-it-not-advisable-to-use-attach-in-r-and-what-should-i-use-instead – Phil Jul 18 '21 at 17:23