Hi, I am newbie to SAS and i need help desperately. getting straight to the point, I am trying to process the sas table into another table as described below: Given: data work; input ID JOB_CD YEAR; cards; 1 4 2006 1 4 2007 1 3 2008 1 5 2009 1 4 2010 2 5 2005 2 5 2006 7 1 2007 ; run; WANT: ID JOB_CD YEAR FIRST_YEAR LAST_YEAR 1 4 2006 2006 2007 1 4 2007 2006 2007 1 3 2008 2008 2008 1 5 2009 2009 2009 1 4 2010 2010 2010 2 5 2005 2005 2006 2 5 2006 2005 2006 7 1 2007 2007 2007 the actual data is much larger but, basically I am trying to group the data by ID and JOB_CD, and get first_year and last_year for each job within each ID. It seemed to work with using "BY ID JOB_CD", FIRST.ID, LAST.ID, RETAIN statements but the problem is, given the case above, ID JOB_CD YEAR FIRST_YEAR LAST_YEAR 1 4 2006 2006 2010 but as you can see this is not what i want. This guy with ID 1 had had a job 4 then changed a job for a few years before changing back to the original job. It does not matter if I use SQL for it. Simpler the better, but I really want this to work. Thanks for reading.
... View more