楼主: jinlin2009
5098 12

[原创博文] 变量中加入分隔符 [推广有奖]

11
bobguy 发表于 2012-2-21 11:43:09
jingju11 发表于 2012-2-20 13:12
你可能没有理解我的意思。一个变量有三十个字节而想当然为数据型变量,在sas里是不合理的。并不是我认为三十 ...
Yes. SAS uses floating calculation. The accuracy may not goes to 30 digits. I remember that it goes to 16 (18) digits.

Here is another example which should work for nay length of character value.


data t1;
   z='123456789012345678901234567890';
   output;
   z='12345678901234567890';
   output;
   z='          12345678901234567890';
   output;
run;

data _null_;
   length  v1-v15 $2 y $44;
   array v(*) v1-v15;
   set t1;

   do i=1 to 15;
      v=peekc(addr(z)+(i-1)*2);
   end;
   y=catx(',', of v
  • );
       put z= ;
       put y= ;
       put /;

    run;
  • 12
    sunset1986 发表于 2012-2-21 12:02:18
    非常感谢~
    An honest tale speeds best being plainly told.
    Cheers!

    13
    sunset1986 发表于 2012-2-21 14:50:20
    maidenhan 发表于 2012-2-17 08:30
    U can use the following code.

    data test01;
    很有启发!
    An honest tale speeds best being plainly told.
    Cheers!

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

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