BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have a variable that looks like this:

Cohort
----------
3
.
.
4
.
.


I have three waves of data for each participant. I want to turn the 'cohort' variable into a 'time-invariant' variable. Is there syntax to make my variable 'cohort' look like this (I basically want to copy the first value for 'cohort' for each successive wave for each participant):

Cohort
---------
3
3
3
4
4
4
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Consider using the LAG function (or a RETAIN with a temporary SAS variable) in a DATA step; also, not really a Statistical Procedures related post, by the way.

Scott Barry
SBBWorks, Inc.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1422 views
  • 0 likes
  • 2 in conversation