Calcite | Level 5

## How to select the immediate next record to baseline record, in sas

How to select the immediate next record to baseline record, in sas
6 REPLIES 6
Diamond | Level 26

## Re: How to select the immediate next record to baseline record, in sas

Can you provide a small example of a data set that you are working with?

--
Paige Miller
SAS Super FREQ

## Re: How to select the immediate next record to baseline record, in sas

Also please, describe in detail what you want to do

Super User

## Re: How to select the immediate next record to baseline record, in sas

Sure, here's an example of a small data set that I'm working with:

Name, Age, Gender
John, 25, Male
Emily, 32, Female
Michael, 45, Male
Sarah, 28, Female

This is a simple data set with four individuals, including their names, ages, and genders. It can be used for various purposes, such as analyzing demographic trends or conducting statistical analysis.

Your question says "How to select the immediate next record to baseline record". So which of the above is the BASELINE and which the "immediate next record"? Redacted as I thought this data was posted by the person asking the question.

The example you show has no "next record" so is not representative of baseline/following data. So doesn't help in the discussion (yet).

Diamond | Level 26

## Re: How to select the immediate next record to baseline record, in sas

@ballardw wrote:

Sure, here's an example of a small data set that I'm working with:

Name, Age, Gender
John, 25, Male
Emily, 32, Female
Michael, 45, Male
Sarah, 28, Female

This is a simple data set with four individuals, including their names, ages, and genders. It can be used for various purposes, such as analyzing demographic trends or conducting statistical analysis.

Your question says "How to select the immediate next record to baseline record". So which of the above is the BASELINE and which the "immediate next record"?

My normal understanding says the example you just showed has no "next record" so is not representative of baseline/following data.

This is confusing. The example data set provided was not from the OP, who has not yet responded. Instead, @ballardw is responding to someone else, @wowspremiumshop , who has jumped into this thread and has not provided anything useful in this discussion (yet), and who I suspect is a spammer (especially if you look at his profile).

--
Paige Miller
Super User

## Re: How to select the immediate next record to baseline record, in sas

@PaigeMiller wrote:

This is confusing. The example data set provided was not from the OP, who has not yet responded. Instead, @ballardw is responding to someone else, @wowspremiumshop , who has jumped into this thread and has not provided anything useful in this discussion (yet).

Good catch. I'm modifying my post.

Super User

## Re: How to select the immediate next record to baseline record, in sas

@Deepthi999 wrote:
How to select the immediate next record to baseline record, in sas

Perhaps if you numbered the observations then it would be easier to find the NEXT record.

For example you might number with the "baseline" record as one and every other record increasing from there.

Perhaps have any records that come before the baseline be numbered as zero (or missing).

``````data want;
set have ;
by subject ;
if first.subject then record=.;
if visit='BASELINE' then record=1;
else if record then record+1;
run;``````

Now you can select the NEXT record by taking those with RECORD=2.

Discussion stats
• 6 replies
• 723 views
• 2 likes
• 5 in conversation