Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: How to use the marco names?


From   [email protected]
To   statalist<[email protected]>
Subject   st: How to use the marco names?
Date   Sun, 02 Aug 2009 14:47:51 +0800

Dear statalists,

I am confused by marco names. Could anyone help me ? 
In my opinion, the following four methods should get the
same results.However, not as I expected.

. fs *.csv
bs.csv     is.csv     price.csv  big.csv    share.csv  mag.csv    plu.csv

. di `r(files)'
bs.csvis.csvprice.csvbig.csvshare.csvmag.csvplu.csv

. local hh `r(files)'

. foreach i of local r(files) {
  2. di "`i'"
  3. clear
  4. insheet using `i'
  5. }
{ required
r(100);

. foreach i in `r(files)' {
  2. di "`i'"
  3. clear
  4. insheet using `i'
  5. }
bs.csv
(6 vars, 13299 obs)
is.csv
(9 vars, 13403 obs)
price.csv
(4 vars, 2714 obs)
big.csv
(6 vars, 53870 obs)
share.csv
(9 vars, 2755 obs)
mag.csv
(8 vars, 45028 obs)
plu.csv
(7 vars, 2751 obs)

. foreach i in `hh' {
  2. di "`i'"
  3. clear
  4. insheet using `i'
  5. }
bs.csv
invalid '"' 
r(198);

. foreach i of local hh {
  2. di "`i'"
  3. clear
  4. insheet using `i'
  5. }
bs.csv
invalid '"' 
r(198);

Thank you for any help.

Sincerely,



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