Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Problem when importing a file


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Problem when importing a file
Date   Thu, 22 Dec 2011 01:02:20 +0000

You can fix the first line by giving 5 names not 4. It looks as if
there is a blank second line. Delete it. Do both of these things in
any decent text editor.

You can -drop- any variable (which you are calling a column) once you
have the data in Stata. That's the least of your problems.

As for the rest, there are "some end of line issues". I think you need
to say what they are.

Nick

On Wed, Dec 21, 2011 at 10:27 PM, Shubhabrata Mukherjee
<joy_stat@yahoo.com> wrote:

>   I am trying to import a text file (created in R) into Stata and having problems with it. Can someone tell me a way to solve this:
>
> The text file looks like the following:
>
> V1 V2 A3 A4
>
> 1 0.015 0.986 0.010 0.001
> 2 0.085 0.975 0.000 0.002
> 3 0.095 0.900 0.010 0.001
> .........
> ......
> ...
>
> I used the command insheet using chunk1.txt,  delim(" ")
>
> Two problem occur
>
> 1) Somehow I need to delete the the numbers in the first column from the second row onwards (1, 2, 3...) as they are not part of the dataset but was created by the text file as placeholders for each row.
>
> 2) At the end there are two variables created ('v110'  and 'v111') where v110 contains the values which should be under A4 and 'v111' gets created because of some end of line issues.
>
> How can I fix these?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index