Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: st: reshape and merge


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: reshape and merge
Date   Thu, 29 Oct 2009 16:25:39 +0100

<> 

" You need to sort out your first data set before you can reshape it..."


Like:

*************
clear*

inp str10 id  
B0103   
B0104A  
B0104B  
B0105A  
B0105B  
B0105C  
end

compress
list, noobs  

gen mainid=substr(id, 1, 5)
gen subid=substr(id, 6,6)
replace subid="A" if subid==""
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Neil Shephard
Gesendet: Donnerstag, 29. Oktober 2009 16:25
An: [email protected]
Betreff: Re: st: reshape and merge

You need to sort out your first data set before you can reshape it...

2009/10/29 "Elisabeth Müller" <[email protected]>:
> Hello,
>
> I have two datasets, which I would like to merge. However, the one is in
long and the other in wide format.
>
> e.g.:
>
> id
>
> first set                   second set
>
> B0103                       B0103
> B0104A                      B0104
> B0104B
> B0105A                      B0105
> B0105B
> B0105C
>
> I tried the reshape command to change the first set from long to wide but
it doesn't work. Does anybody have a suggestion?
>

Could you post the code that you've been trying to use as per the
Statalist FAQ (see link in bottom of all emails).

-- 
"The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data." ~ John Tukey (1986), "Sunset salvo". The American
Statistician 40(1).

Email - [email protected]
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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