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 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 20 Apr 2006 17:59:06 -0500
Reply-To:     Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Subject:      Re: Truncate numerical variables
Comments: To: Mindy <zhumin80@GMAIL.COM>
Content-Type: text/plain; charset=US-ASCII

Mindy:

Try the following code and output follows the code.

data temp; input A; datalines; 1000 2000 30000 4000 ;

data Result; set temp; A3=substr(compress(put(A, 8.)),1,3); drop A; run;

proc print data=Result; run;

The SAS System 11:03 Thursday, April 20, 2006 62

Obs A3

1 100 2 200 3 300 4 400

J S Huang 1-515-557-3987 fax 1-515-557-2422

>>> Mindy <zhumin80@GMAIL.COM> 04/20/06 5:42 PM >>> Hi, all,

I have some numerical variables, i.e. 1000 2000 30000 4000 Now I only want the first three digits of these numerical variables,i.e. 100 200 300 400 How can I do this in SAS? I only know function SUBSTR but it is for character variables.

Thank you,

Mindy


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