Hi,
I have two questions (Q) on the example of my data shown below. The main dataset contains daily data of AskPrice in date1 for 1000 companies. ISIN is the indicator of each company. Source_date_2016 is a date of an event which occurred only once in a period of date1 for each company but, it is repeated because I have daily data for other variables.
Q1- Since I merged two datasets together I lost the sort of date1 for each company, as you see date1 in the example. I wonder how can I sort date1 again for each company.
Q2- Considering the range of date1, I want to keep the data started from Source_date_2016 to 5 working days after Source_date_2016 for each company.
My incomplete code is: keep if inrange(date,Source_date_2015, 5 days)) but I don't know how to fit 5 days in the code. I am not sure either if this is a right code to use considering my query.
I would be grateful if one could help me to find answers to my questions.
Kind regards,
Mahmoud
Example:
input str12 ISIN float date1 double AskPrice int Source_date_2016
"AT00000AMAG3" 20454 . 20878
"AT00000AMAG3" 20467 30.5 20878
"AT00000AMAG3" 20577 30.81 20878
"AT00000AMAG3" 20524 30.12 20878
"AT00000AMAG3" 20466 30.785 20878
"AT00000AMAG3" 20503 27.075 20878
"AT00000AMAG3" 20594 31.45 20878
"AT00000AMAG3" 20621 30.9 20878
"AT00000AMAG3" 20507 26.98 20878
"AT00000AMAG3" 20495 26.795 20878
"AT00000AMAG3" 20612 31.2 20878
"AT00000AMAG3" 20573 32.1 20878
"AT00000AMAG3" 20457 31.68 20878
"AT00000AMAG3" 20604 31.44 20878
"AT00000AMAG3" 20514 29.98 20878
"AT00000AMAG3" 20628 31.465 20878
"AT00000AMAG3" 20551 31.5 20878
"AT00000AMAG3" 20506 27.4 20878
"AT00000AMAG3" 20633 30 20878
"AT00000AMAG3" 20528 30.5 20878
"AT00000AMAG3" 20488 28.25 20878
"AT00000AMAG3" 20607 31.2 20878
"AT00000AMAG3" 20543 31.22 20878
"AT00000AMAG3" 20537 31.255 20878
"AT00000AMAG3" 20635 29.975 20878
"AT00000AMAG3" 20517 29.995 20878
end
format %tdNN/DD/CCYY date1
format %tdnn/dd/CCYY Source_date_2016
I have two questions (Q) on the example of my data shown below. The main dataset contains daily data of AskPrice in date1 for 1000 companies. ISIN is the indicator of each company. Source_date_2016 is a date of an event which occurred only once in a period of date1 for each company but, it is repeated because I have daily data for other variables.
Q1- Since I merged two datasets together I lost the sort of date1 for each company, as you see date1 in the example. I wonder how can I sort date1 again for each company.
Q2- Considering the range of date1, I want to keep the data started from Source_date_2016 to 5 working days after Source_date_2016 for each company.
My incomplete code is: keep if inrange(date,Source_date_2015, 5 days)) but I don't know how to fit 5 days in the code. I am not sure either if this is a right code to use considering my query.
I would be grateful if one could help me to find answers to my questions.
Kind regards,
Mahmoud
Example:
input str12 ISIN float date1 double AskPrice int Source_date_2016
"AT00000AMAG3" 20454 . 20878
"AT00000AMAG3" 20467 30.5 20878
"AT00000AMAG3" 20577 30.81 20878
"AT00000AMAG3" 20524 30.12 20878
"AT00000AMAG3" 20466 30.785 20878
"AT00000AMAG3" 20503 27.075 20878
"AT00000AMAG3" 20594 31.45 20878
"AT00000AMAG3" 20621 30.9 20878
"AT00000AMAG3" 20507 26.98 20878
"AT00000AMAG3" 20495 26.795 20878
"AT00000AMAG3" 20612 31.2 20878
"AT00000AMAG3" 20573 32.1 20878
"AT00000AMAG3" 20457 31.68 20878
"AT00000AMAG3" 20604 31.44 20878
"AT00000AMAG3" 20514 29.98 20878
"AT00000AMAG3" 20628 31.465 20878
"AT00000AMAG3" 20551 31.5 20878
"AT00000AMAG3" 20506 27.4 20878
"AT00000AMAG3" 20633 30 20878
"AT00000AMAG3" 20528 30.5 20878
"AT00000AMAG3" 20488 28.25 20878
"AT00000AMAG3" 20607 31.2 20878
"AT00000AMAG3" 20543 31.22 20878
"AT00000AMAG3" 20537 31.255 20878
"AT00000AMAG3" 20635 29.975 20878
"AT00000AMAG3" 20517 29.995 20878
end
format %tdNN/DD/CCYY date1
format %tdnn/dd/CCYY Source_date_2016
Comment