Statalist The Stata Listserver


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

st: RE: RE: Simple syntax question


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: Simple syntax question
Date   Thu, 20 Jul 2006 17:27:34 +0100

I don't understand this enough to answer you. 

I see that some macro `nj' must be defined 
upstream of this. 

Either this is the whole problem and you 
have simple calculations involving the numbers 
10, 20, 30, 40, which wouldn't seem to 
need a program. You should enter those 
numbers as data. 

Or else you are steadily generalising this,
and 10, 20, 30, 40 are just placeholders, 
in which case it still sounds as if you have some 
standard problem for which Stata commands 
already exist. 

As said, I don't understand this, so I may
be wide of the mark. 

Nick 
[email protected] 

Serguei Kaniovski
 
> OK, I have corrected the first two errors, but how to compute
> sum11_i_j, sum10_i_j, etc over sumT_i_j in the second loop, 
> i.e. instead 
> of ..., which should be a scalar of high precision. Thanks.
> 
> *INITIALIZE SUMS;
> forval i=1/5 {;
> 	local I=`i'+1;
> 	forval j=`I'/`nj' {;
> 		local sum11_`i'_`j'=10;
> 		local sum10_`i'_`j'=20;
> 		local sum01_`i'_`j'=30;
> 		local sum00_`i'_`j'=40;
> 		local sumT_`i'_`j'=100;
> 	};
> };
> 
> *COMPUTE RELATIVE FREQUENCIES;
> forval i=1/5 {;
> 	local I=`i'+1;
> 	forval j=`I'/`nj' {;
> 		local frq11_`i'_`j'=...;
> 		local frq10_`i'_`j'=...;
> 		local frq01_`i'_`j'=...;
> 		local frq00_`i'_`j'=...;
> 	};
> };

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