Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: tabodds command with 'if' option


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: tabodds command with 'if' option
Date   Thu, 2 Mar 2006 21:24:30 -0000

First, please don't send attachments to Statalist. 
This is explained in the FAQ which you should 
read thoroughly before your next posting to 
Statalist. 

Second, I don't know why you put 

... [if cat = 1] 

but the brackets make this illegal and in Stata 
testing for equality requires == not =. Try 

tabodds case year [fweight=freq] if case == 1 

Third, you can loop

forval i = 1/5 { 
	tabodds case year [fweight = freq] if case == `i' 
} 

Finally, -if- is not an option. It is (here) a qualifier. 

Nick 
n.j.cox@durham.ac.uk 

Sean Shu
 
> I have a cross-sectional time series dataset. I want to find 
> whether any 
> trend is presented over the years for different categories. So I used 
> tabodds command. But I want to apply the command for 
> different category 
> seperately. so I write the command syntax over the dataset attached:
> 
>  > tabodds case year [fweight=freq][if cat = 1]
>  > tabodds case year [fweight=freq][if cat = 2]
> ...
>  > tabodds case year [fweight=freq][if cat = 5]
> 
> Can you tell what's wrong with it? and Do I need write syntax to loop 
> the tabodds five time?

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2020 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index