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
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
|