Can you provide a small example of a data set that you are working with?
Also please, describe in detail what you want to do
@wowspremiumshop 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, FemaleThis 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).
@ballardw wrote:
@wowspremiumshop 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, FemaleThis 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).
@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.
@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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.