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: Adding rows to datasheet


From   Eric Booth <ebooth@ppri.tamu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Adding rows to datasheet
Date   Tue, 23 Mar 2010 15:17:59 -0500

>

Similar to others that have posted, I'm not having any issues simply copy/pasting extra rows from an Excel spreadsheet into an existing Stata dataset.
Since you are still having issues, I think a more straightforward solution is to save your excel file in a delimited format, -insheet- and save the data, and then -append- it to the data in memory.   (plus, you mention that you have to do this often, and this process is easy to repeat/automate).

~ Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754


On Mar 23, 2010, at 3:05 PM, Sripal Kumar wrote:

> I tried that.  It works in the example you have give since the command
> ***replace make="Made up" in l** replaces the first column make with
> made up.
> 
> If I have to replicate that I will have to use each header from a
> database of 25 variables and say replace author with-- etc.  Isnt
> there a simpler way?
> 
> 
> 
> On Tue, Mar 23, 2010 at 10:14 AM, Philipp Rehm <philipp.rehm@gmx.de> wrote:
>> .
>> How about something like this:
>> 
>> sysuse auto, clear
>> set obs `=_N+1'
>> replace make="Made up" in l
>> 
>> I've learned this from one of Nick Cox' posts, some years (?) ago.
>> 
>> HTH,
>> Ph
>> 
>> On 3/23/2010 9:48 AM, Sripal Kumar wrote:
>>> 
>>> Hi,
>>> 
>>> This might seem like a no brainer to some of you.  I frequently run
>>> into the trouble where I need to add rows to a previous stata
>>> datasheet.  When I copy rows from excel and try to add to an existing
>>> stata datasheet, it seem to wipe off the header and replace it with
>>> the the newly added first row.  This happens even though I am adding
>>> data to say the 20th row.  The newly inserted row will always replace
>>> the header.  What am I doing wrong here?
>>> 
>>> To explain it a bit better:  My header in stata reads--no. of
>>> patients, dead etc.  If I add an extra row from excel which has say
>>> 2345 and 2...this row deletes the header and the header will now read
>>> as 2345 and 2 instead of no. of patients, dead.
>>> thanks,
>>> Sripal.
>>> *



*
*   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