Anita,
it sounds to me like you are using Stata mainly interactively. You
should think about writing your commands up in do-files, which makes
it very easy to just change a line (-reshape- in your case) and re-run
the do-file. Also, the general advise by people on statalist is to
never overwrite your existing data file, and to not save different
versions of your data after having manipulated it. Instead, save in a
do-file the commands that got you there. This way, you can replicate
your findings, and you still have a chance of knowing what exactly you
typed after 3 months or so.
As to your current problem, I assume that you have not overwritten the
original data file that you had before the -reshape- attempt. If this
is the case, you can -preserve- your current data, then -drop _all-
and -use- your original file. Proceed with -reshape- as you have been
advised. Then save the resulting data temporarily, -restore-, and
-merge-.
Hope this helps,
Eva
2009/3/18 Anita Sayal <[email protected]>:
> I repeated your example..Its works fine doing manually..but how would I replicate for a very large data set and when all data is in single file
>
>
> --- On Wed, 3/18/09, Joseph Coveney <[email protected]> wrote:
>
>> From: Joseph Coveney <[email protected]>
>> Subject: st: RE: Data aligning
>> To: [email protected]
>> Date: Wednesday, March 18, 2009, 11:53 AM
>> Anita Sayal wrote:
>>
>> Would someone Please tell me what commands arto ae used to
>> align the data for
>> Var2 with corresponding Reporter Partner combination in
>> Column 1 and 2 for
>> corresponding years.. trying to do thiis for a large data
>> set..TX
>>
>>
>> Reporter Partner Year Var1 Reporter Partner Year Var2
>> A B 1985 10 A D 1986 .4
>> A C 1986 12 C A 1989 .3
>> A D 1986 14
>> B A 1985 15
>> B C 1985 18
>> C A 1989 20
>>
>> --------------------------------------------------------------------------------
>>
>> -merge- is what I think you're looking for. Try the
>> do-file below, and see
>> whether it gives you the kind of data alignment that you
>> want.
>>
>> Joseph Coveney
>>
>> clear *
>> set more off
>> input str1 Reporter str1 Partner int Year byte Var1
>> "A" "B" 1985 10
>> "A" "C" 1986 12
>> "A" "D" 1986 14
>> "B" "A" 1985 15
>> "B" "C" 1985 18
>> "C" "A" 1989 20
>> end
>>
>> tempfile tmpfil0
>> save `tmpfil0'
>>
>> clear
>> input str1 Reporter str1 Partner int Year float Var2
>> "A" "D" 1986 .4
>> "C" "A" 1989 .3
>> end
>>
>> merge Reporter Partner Year using `tmpfil0', sort
>> list Reporter Partner Year Var1 Var2, noobs sepby(_merge)
>> exit
>>
*
* 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/