I have a series of 6 datasets - for ease of reference, let's call them 2015, 2016, 2017, 2018, 2019, 2020.
I have appended the datasets to make my life a bit easier, however, I am having trouble when creating a real wage variable for each year (the inflation differs across each year, hence I can't apply the same inflation rate across all years).
In my appended dataset, I created a variable "year" to indicate which year the observation came from.
I used the following code to generate real wages for 2015
Code:
gen realearnings_2015=( s5earnings_employees/74.1)*100 if inlist(year, "2015")
Code:
type mismatch
0 Response to Generating a new variable with an if command
Post a Comment