Announcement

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

  • Stata 18 data browser not displaying the complete value of string variables

    Dear folks at the Stata Forums,

    First of all, I'm sorry for not posting my data using dataex. I am prevented from doing so because my data width exceeds the max linesize (I attached the sample data to this post, I promise it's safe). I am working with a dataset that contains the texts of court's judgments. Basically, each observation is a long string of the entire paragraphs (the words are in Chinese). The problem is that when I open the data browser, click on an observation, and copy that to a notepad to read the content, only the first 900 characters are displayed. When I use the Strlen command, I can see that the observations contain more than 900 characters. The analysis I'm doing now requires me to read these contents, so it presents a problem.

    The strange thing is that when I was using Stata 17, this was working: I can copy and paste the entire string. This problem only started to occur when I switched to a computer with Stata 18 (a school computer via remote access). Another strange thing with Stata 18 is that when I move my mouse to the observation, it shows me the preview of the data and the data browser would freeze for 20 seconds.

    Let me know if what I'm asking doesn't make sense. I appreciate your help! One way to replicate my problem could be to copy a long paragraph of word into excel and import it into Stata.
    Attached Files

  • #2
    I can confirm there is a bug when you attempt to copy long text from the Data Editor in Stata 18 which causes the data to be truncated on the clipboard. The threshold is 2045 bytes so anything which is 2045 bytes or shorter will be copied correctly. We will work to get this fixed in an upcoming update. As a work around, you might use export delimited to avoid copying large data to the clipboard.

    For the 20 second pause you observed, it looks like this is related to building a relatively long tooltip which contains Unicode. We should be able to improve this behavior in the future by somewhat restricting the amount of data that we are willing to preview in a tip. Look for this improvement in an upcoming update.

    Comment


    • #3
      Thank you James. Would you happen to know when the next update would be?

      Comment


      • #4
        Temporarily a program to copy to system clipboard may help:

        some data:
        Code:
        clear  
        set obs 2 
        gen v1 = 1000*"虽 " in 1
        replace v1 = 1000*"道 " in 2
        define program copy_strL
        Code:
        capt prog drop copy_strL  
        prog define copy_strL
        args varname obs   
          
        local endjava end 
            
        qui java :
             
        import java.awt.Toolkit;
        import java.awt.datatransfer.Clipboard;
        import java.awt.datatransfer.StringSelection;
        
        Integer i = Data.getVarIndex("`varname'");
        String strLvalue = Data.getStr(i,`obs');
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        StringSelection selection = new StringSelection(strLvalue);
        clipboard.setContents(selection, null);
         
        `endjava'  
        
        end
        test:
        Code:
        copy_strL v1 2

        Comment


        • #5
          Thank you, Bjarte.

          Comment

          Working...
          X