Hello,
I Imported a file (from google trends) that I want to use for stata. I'm interested in using the names that appear in the second row (Alabama, Alaska, Arizona, Arkansas,...) as the variable names of each row. I can generate a substring and create a new variable, but that seems a pretty big hassle for the complete variable set, and I was wondering if there was a more effcient way of doing this.
I can use:
import delimited "filename.csv", varnames(2) rowrange(2)
However, I still have the problem of not that the variable name will be housepricesAlabama... and so on. Is there an efficient way to do this?
Also, my second step will be creating an annual trend, monthly trend and growth from month to month. Would it be better to transpose the rous and columns? If I do this, how can I tell stata to tranpose correctly?
Thank you for the help,
Falco
I Imported a file (from google trends) that I want to use for stata. I'm interested in using the names that appear in the second row (Alabama, Alaska, Arizona, Arkansas,...) as the variable names of each row. I can generate a substring and create a new variable, but that seems a pretty big hassle for the complete variable set, and I was wondering if there was a more effcient way of doing this.
I can use:
import delimited "filename.csv", varnames(2) rowrange(2)
However, I still have the problem of not that the variable name will be housepricesAlabama... and so on. Is there an efficient way to do this?
Also, my second step will be creating an annual trend, monthly trend and growth from month to month. Would it be better to transpose the rous and columns? If I do this, how can I tell stata to tranpose correctly?
Thank you for the help,
Falco
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str7 v1 str24(v2 v3 v4 v5) "" "Category..All.categories" "Category..All.categories" "Category..All.categories" "Category..All.categories" "Month" "house prices: (Alabama)" "house prices: (Alaska)" "house prices: (Arizona)" "house prices: (Arkansas)" "2004-01" "77" "100" "37" "0" "2004-02" "74" "0" "36" "0" "2004-03" "100" "0" "0" "0" "2004-04" "0" "0" "100" "100" "2004-05" "0" "0" "92" "0" "2004-06" "0" "100" "62" "0" "2004-07" "68" "0" "32" "0" "2004-08" "0" "0" "0" "0" "2004-09" "0" "0" "65" "41" "2004-10" "61" "0" "69" "41" "2004-11" "63" "0" "57" "0" "2004-12" "0" "77" "50" "42" "2005-01" "0" "0" "33" "0" "2005-02" "0" "0" "23" "0" "2005-03" "45" "0" "49" "32" "2005-04" "50" "0" "33" "0" "2005-05" "0" "65" "20" "0" "2005-06" "0" "0" "20" "54" end
Comment