vassilisef
Technical User
Hey all,
I am a non-expert, learning SAS for the past 10 months.
I am having one data set with 3 constant counter {-1, +1) windows of dates for one name (ABC):
and I would like to add a new column that repeats the date referring to the "0" counter value for each constant counter {-1, +1) window so that it looks like:
ABC -1 12/23/2008 1.5 12/24/2008
ABC 0 12/24/2008 . 12/24/2008
ABC 1 12/25/2008 2.1 12/24/2008
ABC -1 12/23/2007 2.6 12/24/2007
ABC 0 12/24/2007 . 12/24/2007
ABC 1 12/25/2007 . 12/24/2007
ABC -1 12/23/2006 2.5 12/24/2006
ABC 0 12/24/2006 . 12/24/2006
ABC 1 12/25/2006 2.4 12/24/2006
Please note that in my actual data set my constant counter window is much longer (-300, +300} and I have multiple names-identifiers ( > 10,000). Therefore, transposing any variable by counter window would be preferably avoided.
Thank you in advance,
Vassilis
I am a non-expert, learning SAS for the past 10 months.
I am having one data set with 3 constant counter {-1, +1) windows of dates for one name (ABC):
Code:
data vertical ;
input @1 name $3. +1 counter 2. +1 date mmddyy10. +1 price 3.1 ;
format date mmddyy10. ;
datalines ;
ABC -1 12/23/2008 1.5
ABC 0 12/24/2008 .
ABC 1 12/25/2008 2.1
ABC -1 12/23/2007 2.6
ABC 0 12/24/2007 .
ABC 1 12/25/2007 .
ABC -1 12/23/2006 2.5
ABC 0 12/24/2006 .
ABC 1 12/25/2006 2.4
;
run;
and I would like to add a new column that repeats the date referring to the "0" counter value for each constant counter {-1, +1) window so that it looks like:
ABC -1 12/23/2008 1.5 12/24/2008
ABC 0 12/24/2008 . 12/24/2008
ABC 1 12/25/2008 2.1 12/24/2008
ABC -1 12/23/2007 2.6 12/24/2007
ABC 0 12/24/2007 . 12/24/2007
ABC 1 12/25/2007 . 12/24/2007
ABC -1 12/23/2006 2.5 12/24/2006
ABC 0 12/24/2006 . 12/24/2006
ABC 1 12/25/2006 2.4 12/24/2006
Please note that in my actual data set my constant counter window is much longer (-300, +300} and I have multiple names-identifiers ( > 10,000). Therefore, transposing any variable by counter window would be preferably avoided.
Thank you in advance,
Vassilis