| Date: | Sat, 10 Nov 2007 16:07:41 +0000 |
| Reply-To: | Peter Crawford <crawfordsoftware@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Peter Crawford <crawfordsoftware@GMAIL.COM> |
| Subject: | Re: Multiple variables quesiton |
| In-Reply-To: | <200711101257.lAABkmNx015177@malibu.cc.uga.edu> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
On 11/10/07, Howard Schreier <hs AT dc-sug DOT org> <nospam@howles.com>
wrote:
>
> On Sat, 10 Nov 2007 11:17:34 -0000, Peter <crawfordsoftware@GMAIL.COM>
> wrote:
>
> >On Nov 9, 9:04 pm, art...@NETSCAPE.NET (Arthur Tabachneck) wrote:
> >> 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_, <datan...@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 <art...@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, mhol...@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- Hide quoted text -
> >>
> >> - Show quoted text -
> >
> >a simpler form might be
> > if range( of _numeric_ );
>
> Wouldn't that fail to distinguish all =0 from all =1 etc.?
>
Ahhh.....
eagle eyed Howard Schrier, spotted my mistake (again!).
The correction is important but minor, and still avoids specifying column
names
> if range( of _numeric_ );
should have been
if range( of _numeric_ ) and max( of _numeric_ ) ;
Could also have been
if min( of _numeric_ ) and max( of _numeric_ ) ;
Peter C
|