I have the following string values for two variables. I would like to create a local list from Var1 and/or Var2.
clear
input str4 Var1 str3 Var2
"A f" "H O"
"B" "L"
"C" "Z"
"D" "N t"
"E g" "m o"
"F" "a p"
"G" "w"
"" "q"
"" "po"
end
[/CODE]
when I use levels of this is what I get:
levelsof Var1, local(levels)
`"A f"' `"B"' `"C"' `"D"' `"E g"' `"F"' `"G"'
local List1 I desire is:
`" "A f" "B" "C" "D" "E g" "F" "G" "'
Similarly,
levelsof Var2, local(levels) is:
`"H O"' `"L"' `"N t"' `"Z"' `"a p"' `"m o"' `"po"' `"q"' `"w"'
local List2 I desire is:
`" "H O" "L" "N t" "Z" "a p" "m o" "po" "q" "w" "'
The goal is to eliminate manual entry to create List1 and and List2. Instead just grab them from the Var1 or Var2 and create a local list.
Any help would be appreciated.
Thanks
Related Posts with Creating a local list from a variable
How to generate a price index using the output of a regression (real estate)?Hi all, I would like to generate a price index to determine price changes between house prices in t…
Stata commands for Negative Binomial fixed effects regressionHi, Please, can anyone help me with the commands for a negative binomial fixed effects regression? …
Keep last digit of a variableHi all, I have an (independent) variable 'yearquarter' in my data that looks like "2001q3" and so o…
Rolling regression GARCH volatility predictionHello Statalisters, I have been attempting to run a rolling GARCH model that predicts variance with…
Sensitivity analysis for missing valueDear statalist, I'm running a logistic regression and there are two independent variables with miss…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a local list from a variable
Post a Comment