returns display format


proc fcmp outlib=profunc.funcs.functions;
function frnd(inval,dp) $;
put inval dp;
if dp=
0 then outval=put(round(inval,1),32.);
else if dp=1 then outval=put(round(inval,.1),32.1);
else if dp=2 then outval=put(round(inval,.01),32.2);
else if dp=3 then outval=put(round(inval,.001),32.3);
else if dp=4 then outval=put(round(inval,.0001),32.4);
else if dp=5 then outval=put(round(inval,.00001),32.5);
else if dp=6 then outval=put(round(inval,.000001),32.6);
put outval;
return(outval);

endsub;
run;

Proc format;
Value  $lbdpn
'GLUC'=1
other=
0;
Run;



proc fcmp outlib=profunc.funcs.functions;
function frnd(inval,dp) $;
put inval dp;
if dp=
0 then outval=put(round(inval,1),32.);
else if dp=1 then outval=put(round(inval,.1),32.1);
else if dp=2 then outval=put(round(inval,.01),32.2);
else if dp=3 then outval=put(round(inval,.001),32.3);
else if dp=4 then outval=put(round(inval,.0001),32.4);
else if dp=5 then outval=put(round(inval,.00001),32.5);
else if dp=6 then outval=put(round(inval,.000001),32.6);
put outval;
return(outval);

endsub;
run;
%macro tt(byvars=);
data tt;
lb=
'GLUC';
sd1=
6.345;
aaa=put(
%scan(&byvars,1),$%scan(&byvars,1)dpn.)+2;
put
'xxxxxxxxxxxxxxxxxx' aaa;
if sd1 ne
. then sd=frnd(sd1,put(%scan(&byvars,1),$%scan(&byvars,1)dpn.)+2);
run;
%mend;
%tt(byvars=lb );