Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: From: [email protected]


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: From: [email protected]
Date   Fri, 13 Aug 2010 20:24:11 +0000 (GMT)

--- On Fri, 13/8/10, D.Ronayne wrote:
> I wish to delete "cells" (not observations, aka rows) that
> have missing values for variable x only within x. Hence,
> 
> "drop if x==."
> 
> would not work because it will delete the observations
> across all variables, to explain graphically, I want
> something that looks like this:
> 
> variable x
> 0.998
> .
> .
> .
> 0.658
> .
> 7.801
> .
> 
> to become:
> 0.998
> 0.658
> 7.801
> 
> without disturbing the other variables in the dataset.
> Manually manipulating in Excel is not an option because
> this is done half way through a do file and must be
> done by written commands. Stata is very easy
> to use to drop variables and observations, but can it
> delete specific "cell"

You cannot delete a cell and at the same time keep the 
other variables intact. Take the example below, if we
remove the cell of x for observation 2, what are we 
supposed to put in it's place? Not 0.658, that is the
value for observation 5. If we were to do that than
we would be destroying all the associations in our 
dataset. 

id x      y 
1  0.998  0.15
2  .      0.45
3  .      .
4  .      0.3
5  0.658  1.1
6  .      4.5
7  7.801  .
8  .      3

It is absolutely crucial that the values that
belong to the same observations (i.e. a row in your
dataset) always stay together. You can move entire 
rows up or down, or you can move columns left or right,
but you must never move individual cells up or down 
or left or right. If that happens your entire dataset
has instantly become completely worthless. 

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------


      

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index