## Baseline Value

Solved
Occasional Contributor
Posts: 5

# Baseline Value

Hi All,

In My Project Baseline Value is defined as follows:

Baseline Value 'B' is Last Non-missing measurement before first study drug dose scheduled & unscheduled.

What it means?

Could Any one explain this.

Thanks,

Khan.

Accepted Solutions
Solution
‎05-08-2013 01:19 PM
Super Contributor
Posts: 543

## Re: Baseline Value

Hi, Shazia.

data want;

if endlead not = 1 then do;

set your_data (firstobs = 2) end = endlead;

next_vsvalue = vsvalue;

end;

set in;

by subject;

if last.subject then do;

next_vsvalue = .;

end;

if next_vsvalue = . & vsvalue ne . then baseline_flag = "B";

run;

proc freq data = want;

tables bslflg * baseline_flag;

run;

Good luck!

All Replies
Super Contributor
Posts: 543

## Re: Baseline Value

You probably have a manual of operation, or some data dictionary, or something that should describe your data (better).

But, say you have a data like this:

ID Measurement Drug_Dose

1     4                   0

1     .                    0

1     3                    .

1     2                    12

1     .                    12

I would think your baseline value would be record in red?

The last measurement (non-missing) before first drug-dose...

PS: please use this information with lots of grains of salt :smileyplain: (cautiously)

Occasional Contributor
Posts: 5

## Re: Baseline Value

Hi,

Here I have given the data below, how our data looks, And I want to Flag the Baseline Value 'B' is Last Non-missing measurement before first study drug dose scheduled & unscheduled.

 Subject VisitReport VisitDt TrtStDt NAME OF FORMER VSVALUE VSCODE VARIABLE 101 Baseline 06JUL10:00:00:00 12JUL10:08:00:00 Height 100 1 101 Cycle1Day1 12JUL10:00:00:00 12JUL10:08:00:00 Height 105 1 101 Cycle1Day9 . 19JUL10:00:00:00 Height . 1 101 Cycle2Day12 12AUG10:00:00:00 12JUL10:08:00:00 Height 155 1 101 Cycle2Day2 30JUL10:00:00:00 12JUL10:08:00:00 Height 155 1 101 EndOfTreatment 14OCT10:00:00:00 12JUL10:08:00:00 Height 155 1 101 Baseline 06JUL10:00:00:00 12JUL10:08:00:00 Weight 50 2 101 Cycle1Day1 12JUL10:00:00:00 12JUL10:08:00:00 Weight 45 2 101 Cycle1Day9 . 19JUL10:00:00:00 Weight . 2 101 Cycle2Day12 12AUG10:00:00:00 12JUL10:08:00:00 Weight 65 2 101 Cycle2Day2 30JUL10:00:00:00 12JUL10:08:00:00 Weight 65 2 101 EndOfTreatment 14OCT10:00:00:00 12JUL10:08:00:00 Weight 65 2 101 Baseline 06JUL10:00:00:00 12JUL10:08:00:00 BodyTemp 38 3 101 Cycle1Day1 12JUL10:00:00:00 12JUL10:08:00:00 BodyTemp 35 3 101 Cycle1Day9 . 19JUL10:00:00:00 BodyTemp . 3 101 Cycle2Day12 12AUG10:00:00:00 12JUL10:08:00:00 BodyTemp 44 3 101 Cycle2Day2 30JUL10:00:00:00 12JUL10:08:00:00 BodyTemp 44 3 101 EndOfTreatment 14OCT10:00:00:00 12JUL10:08:00:00 BodyTemp 44 3 102 Baseline 06AUG10:00:00:00 12AUG10:08:00:00 Height 100 1 102 Cycle1Day1 12AUG10:00:00:00 12AUG10:08:00:00 Height 125 1 102 Cycle1Day9 . 19AUG10:00:00:00 Height . 1 102 Cycle2Day12 12SEP10:00:00:00 12AUG10:08:00:00 Height 155 1 102 Cycle2Day2 30AUG10:00:00:00 12AUG10:08:00:00 Height 145 1 102 EndOfTreatment 07AUG10:00:00:00 12AUG10:08:00:00 Height 165 1 102 Baseline 06AUG10:00:00:00 12AUG10:08:00:00 Weight 50 2 102 Cycle1Day1 12AUG10:00:00:00 12AUG10:08:00:00 Weight 45 2 102 Cycle1Day9 . 19AUG10:00:00:00 Weight . 2 102 Cycle2Day12 12SEP10:00:00:00 12AUG10:08:00:00 Weight 65 2 102 Cycle2Day2 30AUG10:00:00:00 12AUG10:08:00:00 Weight 75 2 102 EndOfTreatment 07AUG10:00:00:00 12AUG10:08:00:00 Weight 65 2 102 Baseline 06AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 48 3 102 Cycle1Day1 12AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 35 3 102 Cycle1Day9 . 19AUG10:00:00:00 BodyTemp . 3 102 Cycle2Day12 12SEP10:00:00:00 12AUG10:08:00:00 BodyTemp 44 3 102 Cycle2Day2 30AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 44 3 102 EndOfTreatment 07AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 44 3 103 Baseline 06JUN10:00:00:00 12JUN10:08:00:00 Height 50 1 103 Cycle1day1 12JUN10:00:00:00 12JUN10:08:00:00 Height . 1 103 Cycle1day9 25JUN10:00:00:00 12JUN10:08:00:00 Height . 1 103 Cycle2day1 05JUL10:00:00:00 12JUN10:08:00:00 Height . 1 103 EndofTreatment 25SEP10:00:00:00 12JUN10:08:00:00 Height . 1 103 Baseline 06JUN10:00:00:00 12JUN10:08:00:00 Weight 45 2 103 Cycle1day1 12JUN10:00:00:00 12JUN10:08:00:00 Weight 45 2 103 Cycle1day9 25JUN10:00:00:00 12JUN10:08:00:00 Weight 75 2 103 Cycle2day1 05JUL10:00:00:00 12JUN10:08:00:00 Weight 75 2 103 EndofTreatment 25SEP10:00:00:00 12JUN10:08:00:00 Weight 75 2 103 Baseline 06JUN10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 103 Cycle1day1 12JUN10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 103 Cycle1day9 25JUN10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 103 Cycle2day1 05JUL10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 103 EndofTreatment 25SEP10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3

Thanks,

Khan.

Super Contributor
Posts: 543

## Re: Baseline Value

Ok, in the sample data you sent, can you add another column and describe which row should get the baseline "B" value.

So, I can figure out how to code it.

Thanks.

Occasional Contributor
Posts: 5

## Re: Baseline Value

Hi Anca,

Please see the sample with Baseline flags (BSLFLG), I want this as Output,

Please guide me how it will be.

 Subject VisitReport VisitDt TrtStDt NAME OF FORMER VSVALUE VSCODE BSLFLG VARIABLE 101 Baseline 06JUL10:00:00:00 12JUL10:08:00:00 Height 100 1 101 Cycle1Day1 12JUL10:00:00:00 12JUL10:08:00:00 Height 105 1 B 101 Cycle1Day9 19JUL10:00:00:00 12JUL10:08:00:00 Height . 1 101 Cycle2Day12 12AUG10:00:00:00 12JUL10:08:00:00 Height 155 1 101 Cycle2Day2 30JUL10:00:00:00 12JUL10:08:00:00 Height 155 1 101 EndOfTreatment 14OCT10:00:00:00 12JUL10:08:00:00 Height 155 1 101 Baseline 06JUL10:00:00:00 12JUL10:08:00:00 Weight 50 2 101 Cycle1Day1 12JUL10:00:00:00 12JUL10:08:00:00 Weight 45 2 B 101 Cycle1Day9 19JUL10:00:00:00 12JUL10:08:00:00 Weight . 2 101 Cycle2Day12 12AUG10:00:00:00 12JUL10:08:00:00 Weight 65 2 101 Cycle2Day2 30JUL10:00:00:00 12JUL10:08:00:00 Weight 65 2 101 EndOfTreatment 14OCT10:00:00:00 12JUL10:08:00:00 Weight 65 2 101 Baseline 06JUL10:00:00:00 12JUL10:08:00:00 BodyTemp 38 3 101 Cycle1Day1 12JUL10:00:00:00 12JUL10:08:00:00 BodyTemp 35 3 B 101 Cycle1Day9 19JUL10:00:00:00 12JUL10:08:00:00 BodyTemp . 3 101 Cycle2Day12 12AUG10:00:00:00 12JUL10:08:00:00 BodyTemp 44 3 101 Cycle2Day2 30JUL10:00:00:00 12JUL10:08:00:00 BodyTemp 44 3 101 EndOfTreatment 14OCT10:00:00:00 12JUL10:08:00:00 BodyTemp 44 3 102 Baseline 06AUG10:00:00:00 12AUG10:08:00:00 Height 100 1 102 Cycle1Day1 12AUG10:00:00:00 12AUG10:08:00:00 Height 125 1 B 102 Cycle1Day9 19AUG10:00:00:00 12AUG10:08:00:00 Height . 1 102 Cycle2Day12 12SEP10:00:00:00 12AUG10:08:00:00 Height 155 1 102 Cycle2Day2 30AUG10:00:00:00 12AUG10:08:00:00 Height 145 1 102 EndOfTreatment 07AUG10:00:00:00 12AUG10:08:00:00 Height 165 1 102 Baseline 06AUG10:00:00:00 12AUG10:08:00:00 Weight 50 2 102 Cycle1Day1 12AUG10:00:00:00 12AUG10:08:00:00 Weight 45 2 B 102 Cycle1Day9 19AUG10:00:00:00 12AUG10:08:00:00 Weight . 2 102 Cycle2Day12 12SEP10:00:00:00 12AUG10:08:00:00 Weight 65 2 102 Cycle2Day2 30AUG10:00:00:00 12AUG10:08:00:00 Weight 75 2 102 EndOfTreatment 07AUG10:00:00:00 12AUG10:08:00:00 Weight 65 2 102 Baseline 06AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 48 3 102 Cycle1Day1 12AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 35 3 B 102 Cycle1Day9 19AUG10:00:00:00 12AUG10:08:00:00 BodyTemp . 3 102 Cycle2Day12 12SEP10:00:00:00 12AUG10:08:00:00 BodyTemp 44 3 102 Cycle2Day2 30AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 44 3 102 EndOfTreatment 07AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 44 3 103 Baseline 06JUN10:00:00:00 12JUN10:08:00:00 Height 50 1 B 103 Cycle1day1 12JUN10:00:00:00 12JUN10:08:00:00 Height . 1 103 Cycle1day9 25JUN10:00:00:00 12JUN10:08:00:00 Height . 1 103 Cycle2day1 05JUL10:00:00:00 12JUN10:08:00:00 Height . 1 103 EndofTreatment 25SEP10:00:00:00 12JUN10:08:00:00 Height . 1 103 Baseline 06JUN10:00:00:00 12JUN10:08:00:00 Weight 45 2 103 Cycle1day1 12JUN10:00:00:00 12JUN10:08:00:00 Weight 45 2 B 103 Cycle1day9 25JUN10:00:00:00 12JUN10:08:00:00 Weight . 2 103 Cycle2day1 05JUL10:00:00:00 12JUN10:08:00:00 Weight 75 2 103 EndofTreatment 25SEP10:00:00:00 12JUN10:08:00:00 Weight 75 2 103 Baseline 06JUN10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 103 Cycle1day1 12JUN10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 B 103 Cycle1day9 25JUN10:00:00:00 12JUN10:08:00:00 BodyTemp . 3 103 Cycle2day1 05JUL10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 103 EndofTreatment 25SEP10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3

Thanks,

Shazia

Solution
‎05-08-2013 01:19 PM
Super Contributor
Posts: 543

## Re: Baseline Value

Hi, Shazia.

data want;

if endlead not = 1 then do;

set your_data (firstobs = 2) end = endlead;

next_vsvalue = vsvalue;

end;

set in;

by subject;

if last.subject then do;

next_vsvalue = .;

end;

if next_vsvalue = . & vsvalue ne . then baseline_flag = "B";

run;

proc freq data = want;

tables bslflg * baseline_flag;

run;

Good luck!

Occasional Contributor
Posts: 5

## Re: Baseline Value

Hi Anca,

I tried the above code but it is giving Baseline Flag to "EndofTreatment" also that should exclude.

The output file after executing the above code..

 Subject VisitReport VisitDt TrtStDt NAME OF FORMER VSVALUE VSCODE next_vsvalue baseline_flag VARIABLE 101 Baseline 06JUL10:00:00:00 12JUL10:08:00:00 Height 100 1 105 101 Cycle1Day1 12JUL10:00:00:00 12JUL10:08:00:00 Height 105 1 . B 101 Cycle1Day9 19JUL10:00:00:00 12JUL10:08:00:00 Height . 1 155 101 Cycle2Day12 12AUG10:00:00:00 12JUL10:08:00:00 Height 155 1 155 101 Cycle2Day2 30JUL10:00:00:00 12JUL10:08:00:00 Height 155 1 155 101 EndOfTreatment 14OCT10:00:00:00 12JUL10:08:00:00 Height 155 1 50 101 Baseline 06JUL10:00:00:00 12JUL10:08:00:00 Weight 50 2 45 101 Cycle1Day1 12JUL10:00:00:00 12JUL10:08:00:00 Weight 45 2 . B 101 Cycle1Day9 19JUL10:00:00:00 12JUL10:08:00:00 Weight . 2 65 101 Cycle2Day12 12AUG10:00:00:00 12JUL10:08:00:00 Weight 65 2 65 101 Cycle2Day2 30JUL10:00:00:00 12JUL10:08:00:00 Weight 65 2 65 101 EndOfTreatment 14OCT10:00:00:00 12JUL10:08:00:00 Weight 65 2 38 101 Baseline 06JUL10:00:00:00 12JUL10:08:00:00 BodyTemp 38 3 35 101 Cycle1Day1 12JUL10:00:00:00 12JUL10:08:00:00 BodyTemp 35 3 . B 101 Cycle1Day9 19JUL10:00:00:00 12JUL10:08:00:00 BodyTemp . 3 44 101 Cycle2Day12 12AUG10:00:00:00 12JUL10:08:00:00 BodyTemp 44 3 44 101 Cycle2Day2 30JUL10:00:00:00 12JUL10:08:00:00 BodyTemp 44 3 44 101 EndOfTreatment 14OCT10:00:00:00 12JUL10:08:00:00 BodyTemp 44 3 . B 102 Baseline 06AUG10:00:00:00 12AUG10:08:00:00 Height 100 1 125 102 Cycle1Day1 12AUG10:00:00:00 12AUG10:08:00:00 Height 125 1 . B 102 Cycle1Day9 19AUG10:00:00:00 12AUG10:08:00:00 Height . 1 155 102 Cycle2Day12 12SEP10:00:00:00 12AUG10:08:00:00 Height 155 1 145 102 Cycle2Day2 30AUG10:00:00:00 12AUG10:08:00:00 Height 145 1 165 102 EndOfTreatment 07AUG10:00:00:00 12AUG10:08:00:00 Height 165 1 50 102 Baseline 06AUG10:00:00:00 12AUG10:08:00:00 Weight 50 2 45 102 Cycle1Day1 12AUG10:00:00:00 12AUG10:08:00:00 Weight 45 2 . B 102 Cycle1Day9 19AUG10:00:00:00 12AUG10:08:00:00 Weight . 2 65 102 Cycle2Day12 12SEP10:00:00:00 12AUG10:08:00:00 Weight 65 2 75 102 Cycle2Day2 30AUG10:00:00:00 12AUG10:08:00:00 Weight 75 2 65 102 EndOfTreatment 07AUG10:00:00:00 12AUG10:08:00:00 Weight 65 2 48 102 Baseline 06AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 48 3 35 102 Cycle1Day1 12AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 35 3 . B 102 Cycle1Day9 19AUG10:00:00:00 12AUG10:08:00:00 BodyTemp . 3 44 102 Cycle2Day12 12SEP10:00:00:00 12AUG10:08:00:00 BodyTemp 44 3 44 102 Cycle2Day2 30AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 44 3 44 102 EndOfTreatment 07AUG10:00:00:00 12AUG10:08:00:00 BodyTemp 44 3 . B 103 Baseline 06JUN10:00:00:00 12JUN10:08:00:00 Height 50 1 . B 103 Cycle1day1 12JUN10:00:00:00 12JUN10:08:00:00 Height . 1 . 103 Cycle1day9 25JUN10:00:00:00 12JUN10:08:00:00 Height . 1 . 103 Cycle2day1 05JUL10:00:00:00 12JUN10:08:00:00 Height . 1 . 103 EndofTreatment 25SEP10:00:00:00 12JUN10:08:00:00 Height . 1 45 103 Baseline 06JUN10:00:00:00 12JUN10:08:00:00 Weight 45 2 45 103 Cycle1day1 12JUN10:00:00:00 12JUN10:08:00:00 Weight 45 2 75 103 Cycle1day9 25JUN10:00:00:00 12JUN10:08:00:00 Weight 75 2 75 103 Cycle2day1 05JUL10:00:00:00 12JUN10:08:00:00 Weight 75 2 75 103 EndofTreatment 25SEP10:00:00:00 12JUN10:08:00:00 Weight 75 2 65 103 Baseline 06JUN10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 65 103 Cycle1day1 12JUN10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 65 103 Cycle1day9 25JUN10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 65 103 Cycle2day1 05JUL10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 65 103 EndofTreatment 25SEP10:00:00:00 12JUN10:08:00:00 BodyTemp 65 3 .
Super Contributor
Posts: 543

## Re: Baseline Value

Sure.

Well, this may be bad coding, and not sure how many times do you need to do this, but you could just say

if VisitReport = "EndOfTreatment" then baseline_flag = "";

....

Occasional Contributor
Posts: 5

## Re: Baseline Value

Hi Anca,

I included the below condition to exclude 'EndOfTreatment", Now I got exact Baseline Flags.....

Thanks You so much...for your help......................

if next_vsvalue = . & vsvalue ne . & VISITReport NE 'EndOfTreatment' then baseline_flag = "B";

Thanks,

Khan.

🔒 This topic is solved and locked.