Thanks for your helping, let me explain the story. Suppose I buy stock on 01/01/2015, the price on that day is $1, and then I sell that stock on 01/15/2015, the price is $2, to calculate return, I should use $2-$1. In my date file, 01/01/2015 is variable "start date", 01/15/2015 is "end date", I have another variable called "open price", which means the stock price on start day (back to my example, price of 01/01/2015 is $1, 01/15/2015 is $2" . In order to calculate return, I'm not only need price on start date, but also price on end date, so I need create a new variable called "close price". As I explained in my example, that close price should equal to the "open price" of the "start day" which this "start day" should equal to matched "end day". So what I' m looking for is, given a value in column A, found the same value in column B and then copy corresponding value in column C as new variable. If you still not understand, please review this resources https://communities.sas.com/t5/General-SAS-Programming/Question-vlookup-equivalent-in-SAS/td-p/146702 very similar, but data have ; infile cards dsd dlm='|' truncover; length id reports_to_id $8 name expected $20; input id name reports_to_id expected ; cards; 000006|Smith, John|000007|Phil, Elias 000007|Phil, Elias|000010|Santa, Clause 000008|Turner, Sandra|200000|Andrew, Skype 000010|Santa, Clause|200000|Andrew, Skype 200000|Andrew, Skype|000006|Smith, John 520001|Walker, Walker|000006|Smith, John run; proc sql ; create table want as select a.*,b.name as reports_to_name from have a left join have b on a.reports_to_id = b.id order by a.id ; quit; But I don't know what does these code( with line) did, so I don't how to change the code to solve my problem. Sorry, I don't know how to post example data,,,,,, if still confuse you please let me know. Thank you for your help.
... View more