楼主: dxystata
662 3

[问答] 如何在标红的观测后面加空行 [推广有奖]

版主

已卖:302份资源

大师

37%

还不是VIP/贵宾

-

TA的文库  其他...

Software

中英文Ebook

R学习

威望
2
论坛币
183395 个
通用积分
15333.1475
学术水平
208 点
热心指数
271 点
信用等级
174 点
经验
298627 点
帖子
5586
精华
1
在线时间
13632 小时
注册时间
2006-6-21
最后登录
2025-12-22

初级学术勋章 初级热心勋章 中级热心勋章 初级信用勋章

楼主
dxystata 发表于 2022-4-3 14:26:27 |AI写论文
20论坛币
  1. data aaa;
  2. input x;
  3. cards;
  4. .
  5. .
  6. .
  7. 1
  8. 1
  9. 2
  10. 2
  11. 2
  12. .
  13. .
  14. 3
  15. 3
  16. ;
  17. run;
复制代码
如何在标红的观测后面加空行,谢谢!

最佳答案

乐天天12300 查看完整内容

/*空行是字符型缺失,所以你的x值要转为字符型*/ data bbb; set aaa nobs=last; x_new=strip(x); if (x_new^=lag(x_new) and _n_ ^=1) then do; temp=x_new; call missing(x_new); output; x_new=temp; end; output; if _n_=last then do; call missing(x_new); output; end; ...
关键词:cards Input Data card RDS

沙发
乐天天12300 发表于 2022-4-3 14:26:28
/*空行是字符型缺失,所以你的x值要转为字符型*/
data bbb;
    set aaa nobs=last;
    x_new=strip(x);
    if (x_new^=lag(x_new) and _n_ ^=1) then
        do;
            temp=x_new;
            call missing(x_new);
            output;
            x_new=temp;
        end;
    output;
    if _n_=last then
        do;
            call missing(x_new);
            output;
        end;
    rename x_new=x;
    drop temp x;
run;

藤椅
whymath 发表于 2022-4-3 22:28:32
哪些观测是标红的?

板凳
dxystata 发表于 2022-4-4 15:49:02
whymath 发表于 2022-4-3 22:28
哪些观测是标红的?
.
.
.
1
1
2
2
2
.
.
3
3

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

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