楼主: Jacobi123
1887 4

[问答] 宏内字符转换 [推广有奖]

  • 0关注
  • 0粉丝

高中生

90%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
209 点
帖子
27
精华
0
在线时间
42 小时
注册时间
2011-6-22
最后登录
2016-6-5

楼主
Jacobi123 发表于 2013-5-28 15:46:55 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
由于在宏内没法使用PUT和INPUT,而且宏里面好多好多字符啊。如何转换成所需的数字或者日期呢?
还请大神帮忙,讲解一下。
二维码

扫码加我 拉你入群

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

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

关键词:字符转换 Input put 而且 如何

沙发
Eternal0601 发表于 2013-5-28 17:18:43
可以用putn,putc,inputn,inputc实现
已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
webgu + 20 + 20 + 1 + 1 + 1 我很赞同

总评分: 经验 + 20  论坛币 + 20  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

藤椅
Jacobi123 发表于 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.

板凳
Eternal0601 发表于 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>>)  
*/

报纸
Eternal0601 发表于 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时,就没有出现你所说的问题

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-1 15:44