#First, after you open the data set but before you run MatchIt, use the following code (data is your data frame and ID is your identifer):
####set rownames to id.
rownames(data) <- data$ID
head(data)
#Second, Run the appropriate matchit syntax into an object, like so:
M.OUT1 <- matchit(Treat ~ X1 + X2, data = data)
#Third run the following code:
mm<-M.OUT1$match.matrix
tx<-as.numeric(row.names(mm))
m<-cbind(tx,as.numeric(mm))
m[1:5,]
View(m)
write_sav(data.frame(m),"MatchedPairs.sav")