I am writing a thesis for my Honours year (Advanced Undergraduate Degree) and I am writing it on adolescent drinking levels with an excellent panel dataset. However, the panel data is split into two "cohorts" for example, it is set up as follows:
ID | Wave | Cohort | X | Y | Z |
33 | 1 | K | 3 | 5 | 7 |
55 | 1 | B | 4.3 | 6 | 1 |
33 | 2 | K | 23 | 123 | 213 |
55 | 2 | B | 312 | 32 | 1231 |
33 | 3 | K | 231 | 44 | 34 |
55 | 3 | B | 213 | 23 | 43 |
I want to know the effects on the different cohorts because they are different ages and have different effect levels. My (simplified) code is as follows:
sort cohort
by cohort: ologit alckid i.alcfreqp1 i.alcfreqp2 i.friendsalc, ro
by cohort: margins, dydx(alcfreqp1 alcfreqp2 friendsalc) post
However, I receive an error that the by command and the margins command may not be combined:
margins may not be combined with by
Does anyone have any suggestions for how I can run the margins command to find the margins by each separate cohort? I am struggling to find an alternative at this point.
Thanks in advance,
Jason
0 Response to "By" and "Margins" command error; alternative approach?
Post a Comment