| Date: | Fri, 12 Mar 2010 15:32:35 -0800 |
| Reply-To: | Arthur Tabachneck <art297@NETSCAPE.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Arthur Tabachneck <art297@NETSCAPE.NET> |
| Subject: | Re: adding +6 to age |
|
| In-Reply-To: | <45a5c315-544c-4b64-948b-2e7509c460a2@g11g2000yqe.googlegroups.com> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
I think you want something like:
data ageid (drop=ageid);
set one;
BY ID;
retain ageid;
if first.ID then ageid=age;
else do;
age=ageid+6;
ageid=age;
end;
run;
HTH,
Art
------------
On Mar 12, 5:26 pm, sas analysis <sasanaly...@gmail.com> wrote:
> Hi all,
>
> I have a repeated measures dataset sorted by ID.
> I have age at baseline, visit zero, and would like to add +6 to each
> visit after.
>
> Here is my code:
>
> data ageid;
> set one;
> BY ID;
> retain ageid;
> If first.ID then ageid=age; else ageid=age+6;
> end;
> run;
>
> My data now looks like this:
> ID Age
> 10 74
> 10 74
> 10 74
> 12 50
> 12 50
> 13 40
> 13 40
> 13 40
>
> would like it to look like this:
> ID Age
> 10 74
> 10 80
> 10 86
> 12 50
> 12 56
> 13 40
> 13 46
> 13 52
>
> any ideas?
|