Hey!
I currently have a dataset where I am trying to decorrelete 5 price variables on spot price for electricity on 2 variables of fixed price electricity. I am quite new to Stata, but I have two variables where the first variable A shows the year, for example 2023, and the second variable B shows the year and week, for example 2023-1. What I have been trying is to split the B variable up into B1 and B2 and then add them together to get a date variable to use like this:
split B, parse ("-")
gen date = date(B1 + "w" + B2, "Yw")
But when I do this I am only getting dots in the date variable when browsing through the data (missing values)? And when I see over B1 and B2 they look fine. After that my idea was to use pca after I could get tsset date to work. Do anyone see the problem and could point me in the right direction?
I currently have a dataset where I am trying to decorrelete 5 price variables on spot price for electricity on 2 variables of fixed price electricity. I am quite new to Stata, but I have two variables where the first variable A shows the year, for example 2023, and the second variable B shows the year and week, for example 2023-1. What I have been trying is to split the B variable up into B1 and B2 and then add them together to get a date variable to use like this:
split B, parse ("-")
gen date = date(B1 + "w" + B2, "Yw")
But when I do this I am only getting dots in the date variable when browsing through the data (missing values)? And when I see over B1 and B2 they look fine. After that my idea was to use pca after I could get tsset date to work. Do anyone see the problem and could point me in the right direction?
Comment