Hi,
I have a question in regard to finding the common elements in two vectors.
I have a column vector of tickers for a stock index. I have a loop over time which does some calculations at each day.
At each day inside the time loop, I have around 40 tickers, which are repeating again and again through time.
However, in some days new stocks may introduce to the index so the column vector of tickers at day t may have one of two tickers more than the column vector of tickers at day t-1.
For example, as it can be seen in the following table, at day t, NOP enters into the index for the first time. To observe these new stocks, I want to introduce a new variable as NEW which gives me zero for each common ticker and one for the new tickers which enter the index for the first time. So, how to define variable NEW in SAS/IML environment?
Your advice is appreciated.
DAY (T-1)
| DAY (T) | NEW |
---|
AXA | AXA | 0 |
AIA | AIA | 0 |
BCD | BCD | 0 |
FEJ | FEJ | 0 |
JUD | JUD | 0 |
KID | KID | 0 |
LOD | LOD | 0 |
MIN | MIN | 0 |
OOP | NOP | 1 |
QRE | OOP | 0 |
TRE | QRE | 0 |
WTF | TRE | 0 |
XDE | WTF | 0 |
ZSW | XDE | 0 |
| ZSW | 0 |