Hello everyone,
is there any way to tabulate three variables in a certain manner? I am looking at a comparison of prisoner data for two different years (2011 and 2015). var1 will be the identifier (prisonerID), var2 contains information whether pre-trial detention was ordered or not, var3 is year and var4 is the type of crime committed.
If I go with
tabulate crimetype PTDordered year, column missing rowsort
stata will tell me that there are too many variables specified.
tabulate crimetype PTDordered, column missing rowsort
Will give me the results, but lacks the distinction between the two years of comparison. Is there any way to integrate the year into the table or do i need to produce two separate tables (one for each year) and compare them like this:
tabulate crimetype PTDordered if year==2011, column missing rowsort
Any help will be greatly appreciated
Cheers
John
PS: Data example:
is there any way to tabulate three variables in a certain manner? I am looking at a comparison of prisoner data for two different years (2011 and 2015). var1 will be the identifier (prisonerID), var2 contains information whether pre-trial detention was ordered or not, var3 is year and var4 is the type of crime committed.
If I go with
tabulate crimetype PTDordered year, column missing rowsort
stata will tell me that there are too many variables specified.
tabulate crimetype PTDordered, column missing rowsort
Will give me the results, but lacks the distinction between the two years of comparison. Is there any way to integrate the year into the table or do i need to produce two separate tables (one for each year) and compare them like this:
tabulate crimetype PTDordered if year==2011, column missing rowsort
Any help will be greatly appreciated

Cheers
John
PS: Data example:
prisonerID | PTDordered | year | crimetype |
001 | 1 | 2011 | 1 |
002 | 0 | 2011 | 2 |
003 | 0 | 2015 | 2 |
004 | 1 | 2015 | 5 |
005 | 1 | 2015 | 1 |
006 | 1 | 2011 | 5 |
007 | 0 | 2011 | 6 |
008 | 1 | 2015 | 1 |
009 | 0 | 2011 | 3 |
010 | 1 | 2015 | 2 |
011 | 0 | 2015 | 6 |
Comment