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
marginsplot title (and text box) centered on graph region, not plot region-marginsplot- expands the title and text box across the entire graph region, which twoway plots don'…
How to draw this graph with Stata? Tempogram?Hi. I want to draw this graph with time use data and have been failing to produce one. What would be…
Please help: Merge 1:1 delivers different results after each runthroughI want to merge two datasets based on one variable (neither dataset contains duplicates on this vari…
Setting up a 3-dimensional panel in Stata with interaction termDear All, I have a query related to a using a 3-dimensional panel in Stata which I am unable to fig…
Two-way fixed effects in unbalanced panelHi everyone, I am replicating a paper in an economic journal which uses an unbalanced panel of firm…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a local list from a variable
Post a Comment