I am trying to collapse three (ultimately more) variables on zip codes, state names, and Congressional districts from a survey data set. (I tried to upload the data set but was told that it was not a viable image??). Here are the variables and the first 5 lines of data:
. des lookupzip inputstate cdid115
storage display value
variable name type format label variable label
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lookupzip str5 %-9s Zip code used for CD mapping
inputstate double %10.0g inputstate
State of Residence
cdid115 str2 %-9s CD 115th Congress
and
. clist lookupzip inputstate cdid115 in 1/5
lookupzip inputstate cdid115
1. 77087 Texas 29
2. 45039 Ohio 1
3. 40222 Kentucky 3
4. 85018 Arizona 9
5. 16335 Pennsylvan 3
I converted lookupzip and cdid115 to numeric--and that worked fine, but when I collapsed the variables the state codes were all numeric and I got the message that inputstate had no value labels.
There must be a way to get this done, but I don't know it. If you want the data set, email me (euslaner@umd.edu) and I will send it to you. Many thanks,
Ric
Related Posts with Collapse using both string and alphanumeric
Invalid Label ErrorThe second half of my code is producing an error stating "varlist not allowed". I am working on a d…
descriptive statistics with svyHi Folks, I'm doing a cross-sectional analysis with one wave of a german Panel study. I weighted my…
Testing to compare coefficient from multiple time-series regressionsHi Statlists, I have three time series models that run on the same independent variables, the only …
DFITS after tobitDear all, I would like to exclude some influential observations in a Tobit regression. When using .…
Forming groups by two string variables that are interchangeableDear Statalists, for my research on repeated alliances I am using a dataset in which each observatio…
Subscribe to:
Post Comments (Atom)
0 Response to Collapse using both string and alphanumeric
Post a Comment