BookmarkSubscribeRSS Feed
vThanu
Calcite | Level 5

data have;
input a;
cards;
12.22
132.113
1.2455
;

run;

 

Can any one help me how to replace the entire numeric values expect '.' (decimals) with some charater 

expeted result is like below.

 

xx.xx

xxx.xxx

x.xxxx

 

2 REPLIES 2
Ksharp
Super User

proc fcmp outlib=work.func.fmt;
function fmt(x) $;
  length y $ 32;
  y=translate(strip(put(x,best32.)),'xxxxxxxxxx','0123456789');
  return (y);
endsub;
run;
options cmplib=work.func;
proc format ;
value xfmt
 low-high=[fmt()];
run;
data have;
input a;
format a xfmt32.;
cards;
12.22
132.113
1.2455
;

run;

捕获.JPG

vThanu
Calcite | Level 5

Thank you soo mcuh for you support..

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1273 views
  • 0 likes
  • 2 in conversation