Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to Stata (Windows) #32

Open
cchen-ops opened this issue Apr 13, 2023 · 5 comments
Open

Cannot connect to Stata (Windows) #32

cchen-ops opened this issue Apr 13, 2023 · 5 comments

Comments

@cchen-ops
Copy link

I have tried multiple variations of my Stata path. (i) I've pasted it directly from the file folder (ii) tried it with the executable name and without (iii) tried it with and without .exe., (iv) with and without administrator rights for Rstudio. I keep getting error

Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file 'RStata.log': No such file or directory

Is this a Stata 17 issue? I'm currently using Stata-SE

@BeaLeydier
Copy link

BeaLeydier commented Jun 28, 2023

Hello! I have the same exact issue and error. I have both Stata17 and Stata16 installed, and tried with both. I am working with R version 4.3.0 and I am on Windows.

See below the code I am running (I have also tried the same with version 16 and the corresponding file path)

library(RStata)
setwd("C:/Users/bl517/Documents/Github/ReBuild_Uganda")
options("RStata.StataPath" = "C:/Program Files/Stata17/StataSE-64")
options("RStata.StataVersion" = 17)
stata("0_scripts/0.9.Compile-Baseline.do")

The error message I am getting is

Error in file(con, "r") : cannot open the connection
In addition: Warning messages:
1: In readLines(SRC[1L]) :
  incomplete final line found on '0_scripts/0.9.Compile-Baseline.do'
2: In file(con, "r") :
  cannot open file 'RStata.log': No such file or directory

Any help is appreciated!

@cchen-ops
Copy link
Author

cchen-ops commented Jun 30, 2023

I was eventually able to get it resolved. I was using a group license, and I re-entered the registration information.

This is also how I linked it.

options("RStata.StataPath" = "\"C:\\Program Files\\Stata17\\StataSE-64\"")
options("RStata.StataVersion" = 17)

@kalebsm
Copy link

kalebsm commented Nov 8, 2023

Hello,

I have run into the same issue, run a similar bit of code as cchen-ops, and run into an issue where Stata is trying to read the RStata.log directly in C:\Windows, as per the attachment.

How can I resolve this and run Stata through R?

image

@kalebsm
Copy link

kalebsm commented Nov 12, 2023

@cchen-ops how do you re-enter the registration information? would that solve the issue of RStata.log?

@xiaoming-room
Copy link

I run into the same issue. How do you re-enter the registration information? would that solve the issue of RStata.log? @cchen-ops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants