I have two dataset. I need to fill (or generate) the variable Priceintargetpricedate in dataset one (Target_Prices).
Dataset one (Target_Prices), with the follow variables:
CompanyId ReleaseDate TargetPrice DateTargetPrice Priceintargetpricedate
101 31/01/2014 30.00 31/12/2014
Dataset two (Prices), with the follow variables:
CompanyId Date Price
101 01/12/2014 28.00
101 02/12/2014 26.50
101 03/12/2014 27.00
.
.
.
.
101 30/12/2014 32.00
101 31/12/2014 31.50
101 02/01/2015 30.00
.
.
.
Using CompanyId and DateTargetPrice from dataset one, I want to get the price from dataset two and put this in variable Priceintargetpricedate.
Thanks!
Related Posts with Creating a variable with a data from another dataset
Is there an obvious way to supress the per observation errors which arise from a bad regexm()?Whenever I perform a regex match via say Code: gen var2 = regexm(var1,"(stuff") , the log will spit…
Simulation fails when global macro is calledHello everyone, I am trying to implement a simulation and face an error message. Apparently it has …
Two way area - lines get "thin" as they move upExample code: Code: set obs 200 gen indicator = uniform()<=0.5 gen y = _n twoway (area indicator…
Cleaning the "n.a" in my dataset using StataTo replace the missing values "n.a" to "", I used the following code: Code: ds, has(type string) q…
Random Stata glitchesI'm working with a dataset of ~1000 variables and ~5000 observations. Whenever I try to do my analys…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a variable with a data from another dataset
Post a Comment