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 (February 2011, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 16 Feb 2011 18:47:05 -0500
Reply-To:   Lorne Klassen <lk1@ROGERS.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Lorne Klassen <lk1@ROGERS.COM>
Subject:   Counting digits

Simple question: I want to get the number of digits to the left of the decimal place from a value in a numeric variable (excluding negative sign if there is one).

I can live with the following which works but I'm wondering if it can be even simpler than this? I thought there might be a numeric function to do it directly but couldn't find one.

y = 76877.234; result = countc(put(int(y),32.),,"d"); or result = length(compress(put(int(y),32.)," -"));


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