Announcement

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

  • file in .dat format

    Hi Statalisters,


    I have a file in .dat format (with a record to track the columns). I am not sure how to open it in STATA.

    I tried to open it Notepad and save it as .txt. Then, I tried to import it as a text file with INFILE command, as I usually do, but it does not work.

    Has anyone some suggestions?

    Thank you very much.
    Lydia

  • #2
    I'm sure several of us have suggestions, but they all depend on making assumptions about the format of your data, and about what precisely happened when you tried the infile command. Without making assumptions, the only suggestion I can offer is that you have made a mistake that you need to find and correct.

    We can better help you if we know what commands you have tried and what Stata told you to indicate that there was a problem. Please review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. See especially sections 9-12 on how to best pose your question. Section 12.1 is particularly pertinent

    12.1 What to say about your commands and your problem

    Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!
    ...
    Never say just that something "doesn't work" or "didn't work", but explain precisely in what sense you didn't get what you wanted.
    It's particularly helpful to copy commands and output from your Stata Results window and paste them into your Statalist post using CODE delimiters, as described in section 12.3 of the FAQ.

    (Mike and I were typing at the same time; I wish the forum software could tell us when great minds are typing alike. I'm particularly glad to see Mike's explanation in his first paragraph.)
    Last edited by William Lisowski; 10 Sep 2016, 11:19.

    Comment


    • #3
      To my knowledge, the description ".dat format" does not have any definite meaning, so I suspect no one can help you without more information. For example, I have seen this type name used simply to describe any text (ASCII) file containing numeric data with one line per observation, but I suspect you mean something more than this. And, it's not clear to me what you were trying to do by saving it as ".txt" in Notepad. Also, "with a record to track the columns" has no definite meaning to me. I can understand from that that there is a line in the file to indicate in which columns different variables are located, but your description does not tell anything about the structure of that line.

      So, first you will need to describe in detail whatever you know about the structure of this file. As is, we don't even know if it is a text file, for which -infile- would be relevant.

      Also, per the FAQ, saying "does not work" does not give us any information with which to help you, as there are thousands of ways in which something might not work. What would help in this regards would be if you posted the exact commands you gave to Stata and what the resulting output (error messages, etc.) was.

      (William's message and mine crossed in the ether, which I noticed after my post appeared. Perhaps mine is not completely redundant.)
      Last edited by Mike Lacy; 10 Sep 2016, 11:03. Reason: Explain duplication.

      Comment


      • #4
        note that if you know "nothing" about the file format, you may well be able to use the "hexdump" command to find out about it; please read the help file carefully as, almost certainly, you want to use one of the options such as "tabulate" or "analyze" rather than getting a dump of the entire file

        Comment

        Working...
        X