millwood Or use put function, for example: Mean=put(age_mean, 4.1); percentage=put(percent/100, percent10.1); Probt1=put(Probt, pvalue6.4); Converting Numeric Values to Character Value then output Character value to EXCEL. It is easier to control character value format in EXCEL (no surprise due to internal EXCEL numerical value format).
王笑权 data pye; input a @@; d5=(1/pdf('norm',0))**2/2; format d5 18.15;/*指定输出15位小数|put d5 18.15*/ cards; -3 -2.58 -1.96 -1 0 1 1.96 2.58 3 ; data b;set pye;file '桌面\小数.xls'; put a d5; proc print; run; 我刚才用该程序试验:txt,doc,xls都获得成功。
tomquercio [quote]引用第0楼seu0310于2008-06-05 20:55发表的“在SAS中如何将输出数据结果保留两位小数?”: 在SAS中如何将输出数据结果保留两位小数? [/quote] parameter = round(parameter,0.01);
tctcab GFW printf大法好 sprintf("%.5f", 2.04999999) #> [1] "2.05000" <sup>Created on 2019-10-21 by the reprex package (v0.3.0)</sup>
GFW 感谢两位大佬@tctcab @nan.xiao 的解答,这个问题在另一个帖子里也已经得到@nan.xiao 和@ryo 的解答。 链接如下:https://d.cosx.org/d/411299-411299/8