全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1801 2
2010-09-15
data _null_;
do i=1 to 10;
call symput("num||i",i);
end;
run;
我想把1-10的值赋值给NUM1到NUM10。请问上述代码错误的原因是什么,怎么解决呢?
二维码

扫码加我 拉你入群

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

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

全部回复
2010-9-15 11:49:18
data _null_;
do i=1 to 10;
call symput("num"||strip(i),i);
end;
run;
二维码

扫码加我 拉你入群

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

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

2010-9-17 09:23:47
pobel 发表于 2010-9-15 11:49
data _null_;
do i=1 to 10;
call symput("num"||strip(i),i);
end;
run;
It is a good practice to use call symputx rather ther call symput.

Here is the reasons.

CALL SYMPUTX is similar to CALL SYMPUT except that
  • CALL SYMPUTX does not write a note to the SAS log when the second argument is numeric. CALL SYMPUT, however, writes a note to the log stating that numeric values were converted to character values.
  • CALL SYMPUTX uses a field width of up to 32 characters when it converts a numeric second argument to a character value. CALL SYMPUT uses a field width of up to 12 characters.
  • CALL SYMPUTX left-justifies both arguments and trims trailing blanks. CALL SYMPUT does not left-justify the arguments, and trims trailing blanks from the first argument only. Leading blanks in the value of name cause an error.
  • CALL SYMPUTX enables you to specify the symbol table in which to store the macro variable, whereas CALL SYMPUT does not.
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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