Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: String problem.


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: String problem.
Date   Wed, 7 Sep 2005 17:49:40 +0100

Two thoughts: 

What is wrong with -clonevar- [sic]? 
Your initial question was how to 
get an exact clone, as I recall. 

In view of awkwardnesses with leading 
and trailing blanks, why not trim 
all blanks and concatenate with "_" 
as separator? 

Nick 
[email protected] 

[email protected]

> Indeed, it is the case and Uli's suggestion is not working.
> In fact, the problem is deeper than that.
> I have several Demographic and Health Surveys (DHS) data sets.
> They come in different flavors (households, women, children, etc...)
> I need to merge households and women (individuals) files.
> I go on as indicated by the DHS team (see below and also a previous
> thread on sustr() I posted last week, to which Nick 
> graciously responded).
> 
> But unfortunatelly, for one country, there is no hhid in the 
> household file.
> But there is a caseid in the women file for that country.
> I need thus to generate a hhid (based on cluster and household id)
> in order to be able to merge the household data with individual data
> (in which I can retrieve the hhid variable from the caseid 
> one using substr()).
> The caseid in the individual files contains hhid information.
> The hhid is always 12 characters long, with sometimes leading 
> and trainling
> blanks spaces (that worses the case).
> 
> I just can't figure :
> - how the DHS team constructs the hhid variable (i.e. with 
> leading and trailing
> blanks
> and sometimes blanks within)
> - how to retrieve it in stata.
> 
> One solution of course is to build hhid in household and 
> individual files using
> cluster and household ID variables (g hhid = hv001*100+hv002).
> But I am wondering if one could achieve creating the hhid 
> variable exactely in the DHS tradition
> (ie with 12 characters long). Because, ultimately, I need to 
> pool my data and a uniformity is desirable.
> Said differently, why is it so difficult to create a second 
> hhid2 (without using clonevars)
> that is exactly the same as hhid?

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index