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

RE: st: String problem.


From   [email protected]
To   [email protected]
Subject   RE: st: String problem.
Date   Wed, 7 Sep 2005 13:01:05 -0400

Nick,
Again, it is my mistake and I apoligize for that.
In this case, clonevar is not appropriate since
hhid does not exist in my problematic data set.
I was just testing on another set to see whether
I could create hhid2 similar to hhid, ie with
blanks and of 12 characters long. If it worked,
I could apply the same on the set where the
variable does not exist.
I'll send a mail to DHS team to ask how they
create hhid (they use ISSA and SPSS but this
won't be a big deal).
Thank you very much for your patience and your
support. You all do a terrific job.
Best regards.
Amadou.




                                                                                                                                               
                      "Nick Cox"                                                                                                               
                      <[email protected]>           To:       <[email protected]>                                              
                      Sent by:                         cc:                                                                                     
                      owner-statalist@hsphsun2.        Subject:  RE: st: String problem.                                                       
                      harvard.edu                                                                                                              
                                                                                                                                               
                                                                                                                                               
                      09/07/2005 12:49 PM                                                                                                      
                      Please respond to                                                                                                        
                      statalist                                                                                                                
                                                                                                                                               
                                                                                                                                               
                                                                                                                                               




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/



*
*   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