Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stata freezing after running Qualtricsload command twice

    Hi All,

    I'm currently running Stata 18.5 and am using the qualtricsload command from SSC (posted by Nicholas Winter 3/4/19). This command is incredibly helpful and I have been able to successfully download survey responses from Qualtrics using the API documentation in the help file.

    My issue is that I am trying to download survey responses from multiple surveys, and then later aggregate them into a single file. However, every single time I have tried to run the commands, Stata is able to download and save responses to two surveys fine, but then freezes and locks up when attempting the third. I've never actually gotten an error message; Stata simply becomes unresponsive after the second survey, and remains unresponsive even after letting it sit for several hours.

    Here's the code I am running:

    Code:
    cd "[file path for working directory]"
    qualtricsload SURVEYID1, apitoken(APITOKEN) datacenterid(DATACENTERID), format(csv) saving(FILENAME1,replace)
    qualtricsload SURVEYID2, apitoken(APITOKEN) datacenterid(DATACENTERID), format(csv) saving(FILENAME2,replace)
    qualtricsload SURVEYID3, apitoken(APITOKEN) datacenterid(DATACENTERID), format(csv) saving(FILENAME3,replace)
    qualtricsload SURVEYID4, apitoken(APITOKEN) datacenterid(DATACENTERID), format(csv) saving(FILENAME4,replace)
    Here's a brief summary of the first 4 surveys, none of which have complicated flows or display logic:
    Survey 1: 17 questions, 429 total responses
    Survey 2: 17 questions, 10 total questions
    Survey 3: 21 questions, 67 total responses
    Survey 4: 8 questions, 24 total responses

    I have been able to successfully run commands for all 4 surveys individually (i.e., I can run the first 2 qualtricsload lines, have Stata lock up, force quit, reopen Stata, run the last 2 qualtricsload lines), so the code appears to be working fine. I checked Qualtrics, and I am not close to the API call limits, so I don't think that's the issue. I have also tried adding code to pause for 60 seconds between each qualtricsload command, which did successfully pause after downloading responses for the first two surveys, but did not help with the download issue. Finally, I have also tried saving the qualtricsload commands in separate do files (each ending with exit, clear) and then calling them from a master do file, but the outcome is still the same.

    Ultimately, I have between 25-30 surveys I'd like to download, and so having the program lock up after the second is making this process take a lot longer. Has anyone else experienced this or have suggestions for troubleshooting?

    Thank you!
    Ally Williams

  • #2
    This is difficult to diagnose with the information provided. You might consider emailing the program's author along with a do-file that reproduces the problem.

    I have been able to successfully run commands for all 4 surveys individually (i.e., I can run the first 2 qualtricsload lines, have Stata lock up, force quit, reopen Stata, run the last 2 qualtricsload lines), so the code appears to be working fine.
    If running the commands individually works, you might consider defining a new frame each time you initiate a download and dropping it afterward. This approach may be similar to opening separate instances of Stata.

    Code:
    forval f=1/4{
        frame put *, into(download)
        frame download: cd "[file path for working directory]"
        frame download: qualtricsload SURVEYID`f', apitoken(APITOKEN) datacenterid(DATACENTERID), format(csv) saving(FILENAME`f',replace)
        frame drop download
    }
    Last edited by Andrew Musau; 18 Dec 2024, 03:17.

    Comment


    • #3
      Originally posted by Ally Williams View Post

      I'm currently running Stata 18.5 and am using the qualtricsload command from SSC (posted by Nicholas Winter 3/4/19). This command is incredibly helpful and I have been able to successfully download survey responses from Qualtrics using the API documentation in the help file.

      My issue is that I am trying to download survey responses from multiple surveys, and then later aggregate them into a single file. However, every single time I have tried to run the commands, Stata is able to download and save responses to two surveys fine, but then freezes and locks up when attempting the third. I've never actually gotten an error message; Stata simply becomes unresponsive after the second survey, and remains unresponsive even after letting it sit for several hours.
      I can confirm this is a reproducible issue on StataNow 18.5, MacOS, using the current qualtricsload, Nicholas Winter. Interestingly, the problem is not limited to do-files. Even when called interactively, the third call to the user-contributed qualtricsload command within a single session freezes Stata (no UI elements, including "Break" are clickable and the OS reports that Stata is "not responding").

      Andrew Musau's suggestion of using additional data frames for successive qualtricsload calls does not resolve the issue, however, issuing -clear all- in between qualtricsload calls interactively does allow subsequent calls to qualtricsload to run without freezing. As a workaround until the issue is truly resolved Ally Williams , this should work:

      Code:
      qualtricsload SURVEYID1, apitoken(APITOKEN) datacenterid(DATACENTERID), format(csv) saving(FILENAME1,replace)
      clear all
      qualtricsload SURVEYID2, apitoken(APITOKEN) datacenterid(DATACENTERID), format(csv) saving(FILENAME2,replace)
      clear all
      qualtricsload SURVEYID3, apitoken(APITOKEN) datacenterid(DATACENTERID), format(csv) saving(FILENAME3,replace)
      clear all
      qualtricsload SURVEYID4, apitoken(APITOKEN) datacenterid(DATACENTERID), format(csv) saving(FILENAME4,replace)
      clear all
      You would then need to load each file individually later in the do-file.
      Last edited by Pete Ware; 18 Dec 2024, 20:59.

      Comment


      • #4
        Hi Andrew and Pete,

        Thanks so much for your help and suggestions! I am running Stata 18.5 on Windows, and like Pete, was not able to get the surveys to run when using fames. Like Andrew, the first two frames ran and closed successfully, and then Stata would just freeze.

        I am happy to report that I found a workaround that is similar to what Pete suggested above, which is to have Stata call forward a new instance of Stata, run a do-file that contains the qualtricsload command for a single survey, and then close that instance of Stata.

        Basically, this:
        Code:
        winexec "C:\Program Files\Stata18\StataSE-64.exe" do "[file path for Survey1 do-file]"
        winexec "C:\Program Files\Stata18\StataSE-64.exe" do "[file path for Survey2 do-file]"
        winexec "C:\Program Files\Stata18\StataSE-64.exe" do "[file path for Survey3 do-file]"
        winexec "C:\Program Files\Stata18\StataSE-64.exe" do "[file path for Survey4 do-file]"
        Where each separate do-file includes the Qualtricsload command plus some additional code to load the downloaded .csv into Stata, do some basic cleaning, save as a .dta file, and then close the application. For example,
        Code:
        qualtricsload SURVEYID1, apitoken(APITOKEN) datacenterid(DATACENTERID), format(csv) saving(FILENAME1,replace)
        exit, STATA clear
        I was able to do this successfully for 14 of 16 surveys I set up. For the remaining two, I received an error when trying to run the qualtricsload command (the same error for both surveys):

        java.lang.NullPointerException: Cannot invoke "com.fasterxml.jackson.databind.JsonNode.get(Strin g)" because the return value of "com.fasterxml.jackson.databind.JsonNode.get(Strin g)" is null
        at edu.virginia.nwinter.stataQualtricsSurveyExport.ma in(stataQualtricsSurveyExport.java:179)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invo ke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invo ke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl. invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at com.stata.Javacall.load(Javacall.java:277)
        at com.stata.Javacall.load(Javacall.java:92)

        I am still troubleshooting, but will report back if I can unpack this. If anyone else has thoughts about this error, I would appreciate it! I am able to successfully export a .csv with responses from Qualtrics itself, and the first response in the file does not have any missing fields, in case that matters.

        Thanks everyone!

        Comment


        • #5
          Hi All,

          Just a quick update--the error that was popping up for a couple of the surveys was entirely user error on my part (I had programmed the survey as an admin user on my account but not shared it with the user that was actually doing the API pulls). That's been resolved, and the code for all of my surveys works beautifully; I'm able to export and clean data for 19 surveys in about 30 seconds. I am still using the work-around of calling up a new instance of Stata for each separate survey, but it's working great for me.

          Thanks!
          Ally

          Comment

          Working...
          X