BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Gothardt
Obsidian | Level 7

Hi,

 

I have a dataset sorted by patients; e.g. 2 observations/lines (of data) for patient 1, 4 lines for patient 2 and so on. I have a variable (we call it "LINES") counting the lines for each patient (1, 2, 3, 4 and so on). 

 

I need to create a new variable with data from the the last line for each patient, in other words the highest value of the variable "LINES" (sorted by patients).

 

How do I create a syntax with "highest value" (it should bed sorted by patients already) of a variable?

 

/Mette

 

 

 

 

1 ACCEPTED SOLUTION
3 REPLIES 3
Loko
Barite | Level 11

Hello,

 

Instead of describing in words your situation it will be useful to post an example of your data.

It is easier to look at data you have - data you want than reading a description.

Gothardt
Obsidian | Level 7

Thanks a lot KurtBremser. It was exactly the commando I needed. 🙂

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 1019 views
  • 4 likes
  • 3 in conversation