+ Reply to Thread
Results 1 to 6 of 6

Thread: STATA help with variable renaming!

  1. #1
    Points: 4, Level: 1
    Level completed: 7%, Points required for next Level: 46

    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    STATA help with variable renaming!




    Hello stata crew,

    I've encountered a peculiar problem and can't find a good fix. In short, I'm running surveys, exporting the data to excel, and then appending to my stata master file on a regular basis using insheet or the import function (I'm using stata 12). I do this on a weekly basis and have had no problems. Until now. I just installed office365 and was greeting with the following message when I tried to import the latest excel file:

    Unable to load excel file
    Error: Mandatory element missing

    A quick google search shows that a few other people have had this issue, but no one reports a fix.

    No problem, I though, I'll either save as a comma delineated file or copy and paste into data editor. Both get the data into stata, but both have the same problem -- when I specify that the first line of data should be saved as variable names, all of the variables names are changed to lower case. In my original data set, first letter of variables are capitalized, the rest is lower case (ex: Bio1). This means that I can't append the data sets, because the variable names don't match (stata saves Bio1 as bio1).

    I have several hundred columns (due to the way qualtrics handles survey experiments and randomization), so renaming each variable by hand would take a long really long time, and I'd need to do it each time I import new data. So, two questions:

    1. Any idea why I can't import the excel file properly anymore? I can't find an explanation for the problem either.
    2. Any idea how I can import the data manually (copy and paste or csv), but keep stata from changing the variable names to all lower case?

    Really appreciate any help! I'm far away from the office at the moment, so there are no doors for me to knock on!

  2. #2
    RoboStataRaptor
    Points: 9,969, Level: 66
    Level completed: 80%, Points required for next Level: 81
    bukharin's Avatar
    Location
    Sydney, Australia
    Posts
    1,283
    Thanks
    11
    Thanked 317 Times in 308 Posts

    Re: STATA help with variable renaming!

    For (1) I would suggest contacting Stata technical support. In all likelihood they will want to know about this problem and will fix it.

    For (2) you could try using -insheet- with the case option, or you could import the data and then rename the variables:
    rename *, proper
    (see -help rename group-)

  3. #3
    Points: 318, Level: 6
    Level completed: 36%, Points required for next Level: 32

    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    unable to import multiple excel sheets into STATA12

    Hi everybody,

    I am having issues when I try to import multiple excel sheets (office365) into STATA12. The software is showing the following message: "unable to load excel file; Error : mandatory element missing"

    I have see few similar queries, but were unanswered.Has anyone managed to find a solution?

    It will be great to have your thoughts!

    Many thanks

    Andes

  4. #4
    RoboStataRaptor
    Points: 9,969, Level: 66
    Level completed: 80%, Points required for next Level: 81
    bukharin's Avatar
    Location
    Sydney, Australia
    Posts
    1,283
    Thanks
    11
    Thanked 317 Times in 308 Posts

    Re: STATA help with variable renaming!

    As with the original post, I suggest contacting Stata technical support. If you post the file here I can take a look and see if I can figure something out.

  5. The Following User Says Thank You to bukharin For This Useful Post:

    andes6 (07-12-2013)

  6. #5
    Points: 318, Level: 6
    Level completed: 36%, Points required for next Level: 32

    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: STATA help with variable renaming!

    Quote Originally Posted by bukharin View Post
    As with the original post, I suggest contacting Stata technical support. If you post the file here I can take a look and see if I can figure something out.
    Contacted STATA, but no response. Many thanks for your help.

    Cheers

    A

  7. #6
    Points: 13, Level: 1
    Level completed: 25%, Points required for next Level: 37

    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: STATA help with variable renaming!


    Hi,

    I have been running into the same problem. You could fix this by saving the excel-files that you want to upload as an Excel 97-2003 Workbook. This way, Stata did not run the error anymore. I hope this works for you, too!

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats