# st: Simple syntax question

 From Serguei Kaniovski To statalist@hsphsun2.harvard.edu Subject st: Simple syntax question Date Thu, 20 Jul 2006 17:22:28 +0200

Hi all, I have something like this

*INITIALIZE SUMS;

forval i=1/5 {;
local I=`i'+1;
forval j=`I'/5 {;
local int sum11_``i''_``j''=10;
local int sum10_``i''_``j''=20;
local int sum01_``i''_``j''=30;
local int sum00_``i''_``j''=40;
local int sumT_``i''_``j''=100;
};
};

*COMPUTE RELATIVE FREQUENCIES;
forval i=1/100 {;
local I=`i'+1;
forval j=`I'/5 {;
gen frq11_``i''_``j''=sum11_`i'_`j'/sumT_`i'_`j';
gen frq10_``i''_``j''=sum10_`i'_`j'/sumT_`i'_`j';
gen frq01_``i''_``j''=sum01_`i'_`j'/sumT_`i'_`j';
gen frq00_``i''_``j''=sum00_`i'_`j'/sumT_`i'_`j';
};
};

I would like to generate the relative frequencies of the four different outcomes (sum-variables) and the total sum (sumT). All of these are locals whilst frequencies should be data sheet variables, hence the gen. The problem is the syntax in the gen-argument. I can't get the quotation marks correctly.

Thanks for help
Serguei Kaniovski
*
* 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/