Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Implementing sas like array in Stata


From   [email protected]
To   [email protected]
Subject   st: Implementing sas like array in Stata
Date   Tue, 26 Jul 2005 10:22:20 +1000

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/



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