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
Creating loop on date variableHello, My date variable (x11) is in the format:%td. I am trying to filter out a sub sample of my da…
Generating new variable using hospital codes of multiple diagnosisHello, I have a dataset with patient ids. Each patient is in the dataset multiple times and have mu…
nested loopsin the case that I want to run the analysis of a group of variables by quintiles and considering als…
Problem with highly skewed independent variables and many zerosDear members, I have a binary dependent variable and want to estimate either a logistic regression …
computing skewness and kurtosis of a binary variable with two mutually exclusive optionsHi there, This is my first post on this forum. I am rather confused at a question I have been assign…
Subscribe to:
Post Comments (Atom)
0 Response to Collapse using both string and alphanumeric
Post a Comment