Change from baseline and descriptives

Reply
Regular Contributor
Posts: 180

Change from baseline and descriptives

[ Edited ]

Hello all,

 

I have a dataset looking like this:

 

ID = Subject ID

Stage = Stage of clinical trial (Baseline, Visit1, Visit2, Visit3,...)

Var1 = First numerical variable

Var2 = Second numerical variable

Var3 = Thirs numerical variable

Var4 = Fourth numerical variable

 

 

I wish to calculate for each variable the change from baseline, while including the baseline row for each subject (unlike the SAS paer showing how to do it while withdrawing the baseline row). Is there a simple way of doing it ? My final output should have 4 more variables, for the baseline row they will all be 0, for other rows they will be the difference.

 

Thank you !

Super User
Super User
Posts: 7,720

Re: Change from baseline and descriptives

Hi,

 

Sorry, this is not really a question, but a job description.  Stats programmers are employed to produce these types of tables.  I can't tell you the answer as your company should have its own standards, and mine are IP.  

 

There are some examples out there which the Phuse team have come up with which may help: https://code.google.com/p/phuse-scripts/

 

Although I don't necessarily say this is the best approach.  I am not sure what you find difficult - merge dataset with dataset where baseline flag=Y (you are using SDTM/ADaM data per industry standards right?).  Then you can subtract base from value.  Don't use proc tabulate, use proc means, and output the results to a dataset as you will want to do more processing.  For graphs check out Sanjay's excellent blog with loads of examples of all graphs:

http://blogs.sas.com/content/graphicallyspeaking/

Frequent Contributor
Posts: 144

Re: Change from baseline and descriptives

 

For the second point, if you want to use proc tablate, use the class statement and you will have the proc tabulate by  stages.

 

For the first one, you could do it like you say, with retains, but i will not set to zero the change, i will set it to missing, because if you want to calculate mean and SE, cero observations will be not well calculated.

 

For the thirst, I recomend you to use a template of GTL, doing something like in this example

http://support.sas.com/kb/39/132.html

Super User
Posts: 5,369

Re: Change from baseline and descriptives

You have to be able to sort your data so that the baseline visit comes first:

 

proc sort data=have;

by id stage;

run;

 

If that gives you the proper order, you could use it with:

 

data want;

set have;

by id;

if first.id then do;

   baseline1=.; baseline2=.; baseline3=.; baseline4=.;

end;

retain baseline1-baseline4;

if stage='Baseline' then do;

   baseline1=var1; baseline2=var2; baseline3=var3; baseline4=var4;

   cfb1=0; cfb2=0; cfb3=0; cfb4=0;

end;

else do;

   cfb1=var1 - baseline1;

   cfb2 = var2 - baseline2;

   cfb3 = var3 - baseline3;

   cfb4 = var4 - baseline4;

end;

drop baseline1-baseline4;

run;

 

Good luck.

Ask a Question
Discussion stats
  • 3 replies
  • 406 views
  • 2 likes
  • 4 in conversation