Date: Mon, 8 Sep 2008 17:17:59 -0500
Reply-To: "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Subject: Re: Deleting column based on values in column
In-Reply-To: <200809082024.m88G7psf020980@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
If you can use a where expression to determine the criteria you can
use a data step similar to the following to determin if the variable
is to be dropped.
data have;
input A B C:$1.;
cards;
1 2 a
1 3 b
1 4 c
1 6 d
;;;;
run;
%let drop = ;
data _null_;
if _n_ eq 1 and not eof then call symputx('drop','c');
stop;
set have(where=(c eq 'c')) end=eof;
run;
%put NOTE: DROP=**&drop**;
data need;
set have(drop=&drop);
run;
On 9/8/08, Suren gc <gc_suren@yahoo.com> wrote:
> I have a dataset like this:
> A B C
> 1 2 a
> 1 3 b
> 1 4 c
> 1 6 d
>
> Is there a way I can write SAS program where the comparison is made on the
> value of the column and manipulation is made to the column.
> For instance, if Column C has value c, then deleted the column containing c
> rather than deleting the row.
> Thanks,
> Suren
>
|