LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 1999, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 21 Apr 1999 14:29:23 GMT
Reply-To:     wenyu1030@MY-DEJANEWS.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         wenyu1030@MY-DEJANEWS.COM
Organization: Deja News - The Leader in Internet Discussion
Subject:      How to dedect frequent sign changes

Hi,

I am trying to write an efficient SAS code to handle the following question.

Suppose I have a SAS dataset created with ID number and a variable x. Observations of x consist of consecutive positive numbers followed by consecutive negative numbers, and then maybe consecutive positive numbers again. in fact, this is a large data set so such sign changes may occur more than a number of times. The dataset may look something like this:

1 2 2 3 3 -1 4 -2 5 7 6 8 7 -9 8 -9

What I want to do is to output the observation whenever its sign changes, i.e., its sign is different from its previous one----such as observation 3, 5, and 7 in the above dataset.

Can somebody suggest an efficient code for solving this problem?

Thanks.

wenyu

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own


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