LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (March 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 25 Mar 2009 11:53:19 -0700
Reply-To:   "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject:   Re: sign() equivalent in proc means?
Comments:   To: "./ ADD NAME=Data _null_;" <iebupdte@GMAIL.COM>, Kevin Viel <citam.sasl@GMAIL.COM>
In-Reply-To:   A<ce1fb7450903251112h578e9fafud0b689bd813aebcf@mail.gmail.com>
Content-Type:   text/plain; charset="us-ascii"

Interesting, I forgot that some procs can evaluate based on the formatted value.

Background: doing numerous stats against one dataset with a fair amount of numeric variables. e.g. N,MIN,P25,MEAN,MEDIAN,P75,MAX Doing a proc means is a 4 or 5 line affair when using _numeric_. I needed two more stats, value>0 and value<=0. First, in parallel, I sent a plea to SAS-L to pick the brains to see if one of the stat modes in proc means could do something close, ... while I write a couple of many line SQL queries for alllll the individual variable names, thus doing it manually. The manually written method, of course works, and then can also be fed into proc means for a SUM and I have the results I need. Was just wondering if there was a more concise opportunity.

Setting a true/false flag via Kevin's format or the (sign(xxxx) eq 1) evaluations I did gets the job done, and similar to FREQ working on format values, I've been checking MEANS doc and trying MEANS with format, but no luck so far. If it did, then Kevin's idea of a format would be really good if MEANS could SUM the formatted value.

I'm not getting MEANS working yet with formatted values and I am not finding any MEANS doc that mentions utilizing format values.

Do you (or anyone else) know if you've used MEANS on formatted values?

Mark

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of ./ ADD NAME=Data _null_; Sent: Wednesday, March 25, 2009 11:13 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: sign() equivalent in proc means?

Mark, are you trying to count the number of positive and negative values or do you just want to know ALL POSITIVE, ALL NEGATIVE or BOTH +/-.

As Kevin has suggested you could count them easily by applying a FORMAT, untested.

value sign low - <0 = '-1' 0 = '0' 0< - high ='1'

Then proc freq; tables _numeric_; format _numeric_ sign.;

If you just wanted to know "all pos/all neg/mixture" then I think an examination of MIN and MAX would reveal that info.

On 3/25/09, Kevin Viel <citam.sasl@gmail.com> wrote: > On Tue, 24 Mar 2009 14:41:57 -0700, Terjeson, Mark <Mterjeson@RUSSELL.COM> > wrote: > > >yeah, I did > > (sign(xxxx) ne 1) as xxxx, > >and > > (sign(xxxx) eq 1) as xxxx, > >but was hoping one of the stat functions > >may get close. > > Mark, > > I hope I understand the problem. If so, have you considered a format? > > -Kevin >


Back to: Top of message | Previous page | Main SAS-L page