Date: Tue, 25 Mar 1997 15:28:58 GMT
Reply-To: Jay Weedon <j_weedon@ESCAPE.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Jay Weedon <j_weedon@ESCAPE.COM>
Organization: None
Subject: Re: How does one delete a data value?
Content-Type: text/plain; charset=us-ascii
On Mon, 24 Mar 1997 12:23:59 -0800, "Laurie C. Geck" <ljconniff@ucdavis.edu>
wrote:
>My data set currently includes several individual data values that I
>would like to delete without deleting all the other values of particular
>subjects (observations). For example, I would like to delete the data
>value for Variable 1 for a particular subject, yet keep all remaining
>variables for that subject, as well as keep that Variable 1 for all
>other subjects. What would be the simplest way to do this?
Well it depends what you mean by "delete". SAS datasets are inherently
rectangular - if a variable exists, and an observation exists, there HAS to be
a value in that cell. The question is, What value?
The commonest answer to what you ask is to put a system-missing value (.) if
the variable is numeric, or a blank (" ") if it is character. In many
situations these codes will result in the cell's being ignored, but you do
need to have a good understanding of how SAS treats missing values.
The code is trivial (I use angle brackets to indicate stuff you would fill in
yourself:
data <whatever>;
set <whatever>;
* If variable of interest is numeric, do this;
if <condition that defines subject> then <variable of interest>=.;
* If variable of interest is character, do this;
if <condition that defines subject> then <variable of interest>=" ";
run;
Jay Weedon.