|
Excellent suggestion. However, to catch for potentially cancelling
negative and positive numbers, I'd change the statement to:
if abs(min(of col:)) + abs(max(of col:)) ne 0;
Art
--------
On Fri, 9 Nov 2007 14:49:11 -0600, data _null_, <datanull@GMAIL.COM> wrote:
>Art,
>
>Consider the following slight modification to your program. Using
>COL: allows the program to work with more than 4 observations
>(transposed to variables).
>
>Would not work with lots of observations but the OP mentioned about
>100 as I recall.
>
>data temp2;
> set temp1;
> if min(of col:) + max(of col:) ne 0;
> run;
>
>
>On Nov 9, 2007 1:38 PM, Arthur Tabachneck <art297@netscape.net> wrote:
>> Mike,
>>
>> I don't know if this is any easier than Paige's suggestion, but it
avoids
>> having to deal with the nuances of macro variables:
>>
>> data have;
>> input a b c d e;
>> cards;
>> 1 0 2 0 0
>> 0 0 0 0 0
>> 2 0 0 1 0
>> 3 0 0 0 0
>> ;
>>
>> proc transpose data=have out=temp1;
>> run;
>>
>> data temp2;
>> set temp1;
>> if min(of col1-col4) + max(of col1-col4) ne 0;
>> run;
>>
>> proc transpose data=temp2 out=want (drop=_:);
>> run;
>>
>> HTH,
>> Art
>> ---------
>> On Fri, 9 Nov 2007 10:19:59 -0800, mholmes@CUESTA.EDU wrote:
>>
>> >Hello all,
>> > I am working with a dataset with ~200 variables and ~100
>> >observations each. Most of the data are zeros. Is there a way to
>> >delete all of the variables that have all zero values? The If/then
>> >only seems to work for individual variables. Thanks.
>> >
>> >Mike
>>
|