Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: Re: Reshaping dataset


From   "Darren White" <darrenm.white@health.qld.gov.au>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: Reshaping dataset
Date   Thu, 02 May 2013 10:26:37 +1000

Hi Andrea

This may help as I encountered something similar using  the reshape
command but got around it by 
creating a temporary id
egen id=fill(1 2)
this enabled the reshape without tripping the uniqueness condition

Darren


>>> "Sarah Edgington" <sedging@ucla.edu> 5/2/2013 10:19 am >>>
Andrea,
What syntax did you use?  It sounds like you tried to do a 1:1 merge
when
you needed a 1:m merge.  
If I'm reading your description right, you have 1 observation per SITC
in
your master data and you want that to match to ALL the chains with that
SITC
in your using data.  As long as both those things are true, merge 1:m
should
get you what you need.
-Sarah

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu 
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Andrea
Molinari
Sent: Wednesday, May 01, 2013 4:05 PM
To: statalist
Subject: st: Re: Reshaping dataset

Dear statalisters,

It́s me again trying to reshape a piece of my dataset.

I need to assign values from one trade classification (SITC) to
another
(chain), but with the complexity that there may be one SITC that
corresponds
to more than one chain. I then need to sum (with
-egen-) the values by SITC to group them into the chain
classification.

When I tried to use the -merge- command to do this, as the identifying
variable to use -merge- (SITC) "does not uniquely identify observations
in
the using data" (sic), the system does not allow me to merge the two
datasets.

Does anyone know of any other command that allows me to do this?

Cheers!
Andrea

On 26 April 2013 13:24, Andrea Molinari <anmolinari@gmail.com> wrote:
> Dear statalisters,
>
> Ím working with a dataset which groups many dimensions and Ím
having 
> a little trouble reshaping the data for the (rather basic) 
> calculations I need to do.
>
> The dataset has the following columns:
>
> year flow partner value cadena usoecon subcadena cadenacompartida1
> subcadenacompartida1 cadenacompartida2 subcadenacompartida2
>
> In order to regroup the data summing "value" by year, flow, cadena 
> subcadena and usoecon, I need that:
>
> - the values in cadenacompartida1 and cadenacompartida2 go under
those 
> in the column "cadena"
>
> - the values in subcadenacompartida1 and "subcadenacompartida2"   go
> under those in the column "subcadena"
>
> To do so, I tried several options with -reshape long-, but I dońt 
> seem to get the right reshaping to get the data in the way I need to

> then calculate:
>
> bysort year flow cadena subcadena usoecon: egen double 
> svalue=sum(value)
>
> Any ideas of those handling large datasets would be more than
welcomed!
>
> Cheers,
> Andrea
>
> --
> Andrea Molinari, PhD
> Investigadora Asistente
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)

> Instituto Interdisciplinario de Economía Política de Buenos Aires 
> (IIEP- BAIRES) Córdoba 2122, 2do. piso 
> (http://iiep-baires.econ.uba.ar)
> Tel: +54 11 4374-4448, int. 6362



--
Andrea Molinari, PhD
Investigadora Asistente
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
Instituto Interdisciplinario de Economía Política de Buenos Aires
(IIEP-
BAIRES) Córdoba 2122, 2do. piso (http://iiep-baires.econ.uba.ar)
Tel: +54 11 4374-4448, int. 6362

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search 
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/ 
*   http://www.ats.ucla.edu/stat/stata/

********************************************************************************
This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.
Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited.  The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.
If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender by telephone collect on Australia +61 1800 198 175 or by return email.  You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.
If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.
Although Queensland Health takes all reasonable steps to ensure this email does not contain malicious software, Queensland Health does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.
Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.
**********************************************************************************

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index