Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Table output from three variables


From   Sergiy Radyakin <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Table output from three variables
Date   Fri, 26 Jul 2013 18:54:32 -0400

Haluk,

when you write "I want to get a table ..." do you mean table of output? then
      table Compound Year, c(mean Amount)
or dataset? then
      reshape wide ...

Can reshape be avoided? Yes. But we need to know what particular
aspect of reshape you want to avoid?
But note also that -reshape- is supported by StataCorp, while a
similar user-written command might be hard to help then later in a
couple of years when you encounter a non-standard situation.

Best, Sergiy



On Fri, Jul 26, 2013 at 6:35 PM, Haluk Vahaboglu <[email protected]> wrote:
> Dear All,
> Just a quick (and a simple) question.
> I am using Stata 12.1 for Linux 64 bit.
> I want to get a table from three variables, using one as row other as column and the third as the element of the matrix (table).
> Data is something like:
> Compound Year Amount
> X 2009 5
> X 2010 9
> X 2011 2
> Y 2009 3
> Y 2011 8
>  want to get a table as:
> . 2009 2010 2011
> X 5 9 2
> Y 3 . 8
>
> This might be achieved via the "reshape wide.." command but could this be also possible without reshaping the data?
> I cannot find an exact answer to my problem in help files, manuals, FAQ (there is one without an exact solution to my problem) and google search.
> To a similar thread by AJ Medwick (http://www.stata.com/statalist/archive/2009-05/msg00337.html) Nick J Cox  posted a solution"tab var1 var2 [aw=var3], matcell(matrix)" that gives an output which is not what I want.
>
> I will appreciate any help
>
> Haluk Vahaboglu
>
> *
> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index