GVKEY | fyear | EXECID | TITLEANN |
002538 | 2007 | 02158 | president & CEO |
002538 | 2008 | 02158 | president & CEO |
002538 | 2009 | 02158 | |
002538 | 2010 | 02158 | |
002538 | 2011 | 42441 | |
002538 | 2012 | 42441 | chmn. & CEO |
002538 | 2013 | 42441 | chmn. & CEO |
I want the following result
GVKEY | fyear | EXECID | TITLEANN |
002538 | 2007 | 02158 | president & CEO |
002538 | 2008 | 02158 | president & CEO |
002538 | 2009 | 02158 | president & CEO |
002538 | 2010 | 02158 | president & CEO |
002538 | 2011 | 42441 | |
002538 | 2012 | 42441 | chmn. & CEO |
002538 | 2013 | 42441 | chmn. & CEO |
can anyone help me with this?
Standard use case for RETAIN.
data want;
set have;
by GVKEY;
retain newTitle;
if not missing(titleAnn) then newTitle = titleAnn;
if first.GVKEY and missing(titleAnn) then call missing(newTitle);
run;
@abdulla wrote:
GVKEY fyear EXECID TITLEANN 002538 2007 02158 president & CEO 002538 2008 02158 president & CEO 002538 2009 02158 002538 2010 02158 002538 2011 42441 002538 2012 42441 chmn. & CEO 002538 2013 42441 chmn. & CEO
I want the following result
GVKEY fyear EXECID TITLEANN 002538 2007 02158 president & CEO 002538 2008 02158 president & CEO 002538 2009 02158 president & CEO 002538 2010 02158 president & CEO 002538 2011 42441 002538 2012 42441 chmn. & CEO 002538 2013 42441 chmn. & CEO can anyone help me with this?
Standard use case for RETAIN.
data want;
set have;
by GVKEY;
retain newTitle;
if not missing(titleAnn) then newTitle = titleAnn;
if first.GVKEY and missing(titleAnn) then call missing(newTitle);
run;
@abdulla wrote:
GVKEY fyear EXECID TITLEANN 002538 2007 02158 president & CEO 002538 2008 02158 president & CEO 002538 2009 02158 002538 2010 02158 002538 2011 42441 002538 2012 42441 chmn. & CEO 002538 2013 42441 chmn. & CEO
I want the following result
GVKEY fyear EXECID TITLEANN 002538 2007 02158 president & CEO 002538 2008 02158 president & CEO 002538 2009 02158 president & CEO 002538 2010 02158 president & CEO 002538 2011 42441 002538 2012 42441 chmn. & CEO 002538 2013 42441 chmn. & CEO can anyone help me with this?
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: