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 (October 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 11 Oct 2010 20:54:42 -0500
Reply-To:   Joe Matise <snoopy369@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Joe Matise <snoopy369@GMAIL.COM>
Subject:   Re: removing delimiters
Comments:   To: jyothi kambhampati <jyothi.kambhampati@gmail.com>
In-Reply-To:   <941871A13165C2418EC144ACB212BDB001A29130@dshsmxoly1504g.dshs.wa.lcl>
Content-Type:   text/plain; charset=ISO-8859-1

Given the OP question, I think it should be something more like:

data _null_; c = "-1627.2-"; d = ifc(substr(c,1,1)='-',cats('-',compress(c,'.','kd')),compress(c,'.','kd')); put _all_; run;

Not at SAS and can't test it but it should work. This should keep only decimals, numerals, and prepend the negative sign when appropriate.

-Joe

On Mon, Oct 11, 2010 at 7:53 PM, Nordlund, Dan (DSHS/RDA) < NordlDJ@dshs.wa.gov> wrote:

> > -----Original Message----- > > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > > Nat Wooding > > Sent: Monday, October 11, 2010 4:51 PM > > To: SAS-L@LISTSERV.UGA.EDU > > Subject: Re: removing delimiters > > > > PRX makes my head hurt. Here is a traditional data step approach. > > > > Nat Wooding :) > > > > data _null_; > > c = "-1627.2-"; > > d = reverse( substr( reverse( c ) , 2 )); > > put _all_; > > run; > > > Or maybe (?) a little simpler, depending on what the rest of the data > actually looks like. > > data _null_; > c = "-1627.2-"; > d = substr( c , 1, length(c)-1 ); > put _all_; > run; > > But as someone else suggested, it might be better to fix the problem > earlier, i.e. when the values are first generated (if possible). > > Hope this is helpful, > > Dan > > Daniel J. Nordlund > Washington State Department of Social and Health Services > Planning, Performance, and Accountability > Research and Data Analysis Division > Olympia, WA 98504-5204 >


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