Announcement

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

  • Dictinction between #null and 0 in stata

    Hello my friends. I am a nordic guy writing my bachelor's thesis in economics using stata for descriptive analysis. I have aquired a microsoft excel file with data. In this excel file wherever someone has failed or not wanted to answer the answer is described by "#null" and whenever using a dummy variable the answer is described by 1 and 0. My problem is how i make the disctinction between "#null" and "0" in stata when i import the excel file? It just shows "0" for all entries. I am using stata 12 for the moment.

    Thanks in advanced, Svensson.

  • #2
    Can you replace the "#null" with something else before doing the import?

    Can you attach a file with the exact offending text? (just an example, not the complete data).
    You should:

    1. Read the FAQ carefully.

    2. "Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!"

    3. Describe your dataset. Use list to list data when you are doing so. Use input to type in your own dataset fragment that others can experiment with.

    4. Use the advanced editing options to appropriately format quotes, data, code and Stata output. The advanced options can be toggled on/off using the A button in the top right corner of the text editor.

    Comment


    • #3
      Originally posted by Roberto Ferrer View Post
      Can you replace the "#null" with something else before doing the import?

      Can you attach a file with the exact offending text? (just an example, not the complete data).
      Possibly, but is there a way to replace all "#null"'s in excel with one command? Or else it would take me forever to replace all manually.

      Not sure if you wanted me to just copy past a part of the data set in a new excel file?
      The respondents in this poll have either answered yes or no (1 or 0) or nothing at all "#null". The people answering nothing won't do me any good in my analysis so i need to make a distinction.



      excelfile.xlsx
      Attached Files

      Comment


      • #4
        I'm able to import fine using import excel "excelfile.xlsx", clear first. Stata automatically replace the "#null" with missing and leaves the 0's and 1's as is. Can you show us what exactly you type and what the Stata data looks like?

        - Elan

        Comment


        • #5
          For some reason it does exibit empty cells in stata when i copy paste just the relevant part of my excel dataset(i have a huge dataset with both dummy and other questions with cathegorical answers 1-10). Well i guess you could call it a solution. Probably something to do with the format.

          Comment


          • #6
            Originally posted by Medel-Svensson View Post
            Possibly, but is there a way to replace all "#null"'s in excel with one command? Or else it would take me forever to replace all manually.
            Not necessarily true. MS Excel and many text editors have a search and replace feature that does all the work for you.
            You should:

            1. Read the FAQ carefully.

            2. "Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!"

            3. Describe your dataset. Use list to list data when you are doing so. Use input to type in your own dataset fragment that others can experiment with.

            4. Use the advanced editing options to appropriately format quotes, data, code and Stata output. The advanced options can be toggled on/off using the A button in the top right corner of the text editor.

            Comment


            • #7
              In Excel, the keystroke is Ctrl-H and the menu item is under "Find & Select". Just put #NULL! in the "Find what" box and nothing in the "Replace with" box.

              Comment

              Working...
              X