Dear all
I am trying to implement SAS like array in Stata. I used the example given
in the FAQ 'How do I implement SAS-like Arrays in Stata?' I am trying to
calculate rates using variables in 'array2' as numerators and variables in
'array3' as denominators. However, it appears that Stata is not recognising
variable names as variables. The log is as follows.
Thanks in advance.
. local array1 "feleclsw finclo fintprtw flabour"
. local array2 "feleclsw_n finclo_n fintprtw_n flabour_n"
. local array3 "feleclsw_d finclo_d fintprtw_d flabour_d"
. local i = 1
. local n: word count `array1'
. while `i' <= `n' {
2. local var1 : word `i' of `array1'
3. local var2 : word `i' of `array2'
4. local var3 : word `i' of `array3'
5. replace `var1' = `var2' / `var3'
6. local i = `i'+1
7. }
feleclsw ambiguous abbreviation
r(111);
end of do-file
r(111);
Cheers
Pramod Adhikari
Canberra, Australia
-----------------------------------------------
ABS Web Site: www.abs.gov.au
*
* 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/