SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 585|回复: 1
打印 上一主题 下一主题

HELP: Time issue using SAS code!!

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2011-3-8 03:39:45 | 只看该作者

HELP: Time issue using SAS code!!

Hi everyone,

I have a question about time issue.

The original dataset has three columns:
ID, tsfd(time since first dose), dose(for ID=1, dosing twice,50 at time=0 and 100 at time=10).

Now I want to add another column called "tad"(time after last dose): when dosing(dose^=0), tad becomes 0, and calculate relative time interval!

I want output like this:

ID          tsfd                    dose         tad
1             0                        50              0
1             1                         0               1
1             5                         0               5
1             8                         0               8
[color=#4000FF:2uyxugnk]1            10                   100               0
1            12                      0               2
1            15                      0               5[/color:2uyxugnk]
2
2
....

How can I use SAS code to add the column "tad"??

Thanks!!!
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2011-3-8 20:45:26 | 只看该作者

Re: HELP: Time issue using SAS code!!

希望这个是楼主要的
[code:2vdbymz1]
data have;
        input ID $ tsfd dose;
datalines;
1 0 50
1 1 0
1 5 0
1 8 0
1 10 100
1 12 0
1 15 0
;
run;
data want(drop=temp);
        set have;
        retain temp;
        if dose ne 0 then temp=tsfd;
        tad=tsfd-temp;
run;
[/code:2vdbymz1]
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2025-6-11 10:48 , Processed in 0.128461 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表