全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1922 4
2013-05-28
由于在宏内没法使用PUT和INPUT,而且宏里面好多好多字符啊。如何转换成所需的数字或者日期呢?
还请大神帮忙,讲解一下。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-5-28 17:18:43
可以用putn,putc,inputn,inputc实现
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-5-29 17:26:19
Eternal0601 发表于 2013-5-28 17:18
可以用putn,putc,inputn,inputc实现
我试了下,貌似报错了。不知道具体如何操作。还请赐教。谢谢啦。

SYMBOLGEN:  Macro variable P resolves to 0.0011267876
WARNING: Argument 2 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is
         out of range.
NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The
      result of the operations have been set to a missing value.
SYMBOLGEN:  Macro variable P resolves to 0.0011267876
WARNING: Argument 2 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is
         out of range.
NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The
      result of the operations have been set to a missing value.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric
       operand is required. The condition was: %sysfunc(inputn(&p,PVALUE6.4)) se 0.7
ERROR: The macro TTEST will stop executing.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-5-30 18:57:19
Jacobi123 发表于 2013-5-29 17:26
我试了下,貌似报错了。不知道具体如何操作。还请赐教。谢谢啦。

SYMBOLGEN:  Macro variable P resol ...
%let p=0.0011267876        ;
%put  &p;


%let test=%sysfunc(inputn(&p,best6.4))  ;
%put  &test;

%let test2=%sysfunc(inputn(&p,PVALUE6.4))  ;
%put  &test2;

/*
INPUTN Function
Syntax
INPUTN(source, informat<,w<,d>>)  
*/
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-5-30 19:01:17
Eternal0601 发表于 2013-5-30 18:57
%let p=0.0011267876        ;
%put  &p;
出现你所说的问题,主要是由于你用的inputn语句中的第二argument中informat用的是PVALUE6.4,然而你仔细查下就会发现,SAS实际上是没有 PVALUEw.d这个informat的,而是只有PVALUEw.d Format,所以当你将之改为SAS有的informat如best6.4时,就没有出现你所说的问题
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群