Dear all, I'm posting here in desperate search for help.
I have an example data set in long format with 5 participants (id=101-105).
This is a four-year study that collected data from each participant annually (2010-2013).
However, race ("race") data are incomplete.
I'd like to create a new variable ("race2") that extracts all available race data and apply them across all the years.
So far, my attempt involved creating 2 loops (i=loop thru id; y=loop thru year) but no success.
Here's a screenshot to illustrate what I mean.
(Note: actual data has has 2+ million rows, so wouldn't be able to do it manually.)
Thanks,
Michael

I have an example data set in long format with 5 participants (id=101-105).
This is a four-year study that collected data from each participant annually (2010-2013).
However, race ("race") data are incomplete.
I'd like to create a new variable ("race2") that extracts all available race data and apply them across all the years.
So far, my attempt involved creating 2 loops (i=loop thru id; y=loop thru year) but no success.
Here's a screenshot to illustrate what I mean.
(Note: actual data has has 2+ million rows, so wouldn't be able to do it manually.)
Thanks,
Michael

Comment