Statalist


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

st: AW: changing a table format


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: changing a table format
Date   Mon, 9 Nov 2009 18:45:29 +0100

<> 



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

inp sex:mylabel age desir_age freq , auto 
female 22 25 16
male 23 20 27
female 23 20 23
male 23 21 2
female 23 21 4
male 23 22 5
end

compress
list, noobs 

reshape wide freq, i(desir_age age) j(sex)
l, noo
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Ekaterina
Hertog
Gesendet: Montag, 9. November 2009 18:32
An: statalist@hsphsun2.harvard.edu
Betreff: st: changing a table format

Dear all,
I have got a table with 4 variables

sex age desir_age freq
female 22 25 16
male 23 20 27
female 23 20 23
male 23 21 2
female 23 21 4
male 23 22 5
and I would like to turn ?sex? and ?freq? variables into ?frequency 
male? and ?frequency female? to be able to make a graph.

So the resulting table should look something like that
age desir_age freq_m freq_f
22 25 - 16
23 20 27 23
23 21 2 4
23 22 5 -
I have looked at the -table- command but I cannot quite figure out how 
to do it.
I would be most grateful for any advice!
Sincerely yours,
Ekaterina



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index