BookmarkSubscribeRSS Feed
Deepthi999
Calcite | Level 5
How to select the immediate next record to baseline record, in sas
6 REPLIES 6
PaigeMiller
Diamond | Level 26

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

--
Paige Miller
AMSAS
SAS Super FREQ

Also please, describe in detail what you want to do

ballardw
Super User

@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, 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).

PaigeMiller
Diamond | Level 26

@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, 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
ballardw
Super User

@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.

Tom
Super User Tom
Super User

@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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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