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

Re: st: How to fetch VCE


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   Re: st: How to fetch VCE
Date   Thu, 8 Aug 2002 17:14:40 +0100

James Ferng

Thanks very much for providing me the way to fetch VCE. But, following
your
program, I got the error message r(2000), which says no observations.
I ran
the stata problem as follow:

use ":iMac:Users:james:Desktop:Thesis:I-Lung:fxdata.dta", clear
sort code
levels code, local(levels)
qui foreach l of local levels {
    regress rtnstk rtnmkt rtndla dlayen rtnyen if code ==`l'
    matrix cv`l' = get(VCE)
     }

----------------------------------------------------------------

The details are

 use ":iMac:Users:james:Desktop:Thesis:I-Lung:fxdata.dta", clear

. sort code

. levels code, local(levels)
1101 1102 1103 1104 1107 1108 1109 1110 1201 1203 1204 1206 1207 1209
1210
1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222
>  1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1303 1304
1305 1306
1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1
> 317 1319 1321 1402 1407 1408 1409 1410 1413 1414 1416 1417 1418 1419
1420 1422
1423 1431 1432 1433 1434 1435 1436 1437 1438 143
> 9 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452
1453 1454
1455 1456 1457 1458 1459 1460 1462 1463 1464 1465
> 1466 1467 1468 1469 1470 1471 1503 1504 1505 1506 1507 1510 1513
1514 1515
1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 15
> 26 1601 1602 1603 1604 1605 1606 1608 1609 1611 1612 1613 1614 1701
1704 1707
1708 1709 1710 1711 1712 1713 1714 1715 1716 1717
>  1718 1720 1721 1722 1723 1802 1805 1806 1807 1808 1809 1810 1902
1903 1904
1905 1906 1907 1909 2002 2005 2006 2007 2008 2009 2
> 010 2011 2012 2013 2014 2016 2017 2019 2020 2021 2022 2023 2024 2025
2027 2028
2029 2030 2101 2102 2103 2104 2105 2106 2107 210
> 8 2109 2201 2202 2204 2206 2207 2301 2302 2303 2304 2305 2306 2308
2310 2311
2312 2313 2314 2315 2316 2317 2318 2319 2320 2321
> 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334
2335 2336
2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 23
> 47 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360
2361 2362
2363 2364 2365 2366 2367 2368 2369 2370 2371 2373
>  2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386
2387 2388
2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2
> 399 2401 2402 2403 2404 2405 2406 2501 2504 2505 2506 2509 2511 2512
2513 2514
2515 2516 2517 2518 2520 2521 2522 2523 2524 252
> 5 2526 2527 2528 2530 2531 2533 2534 2535 2536 2537 2538 2539 2540
2542 2543
2544 2547 2601 2603 2604 2605 2606 2607 2608 2609
> 2610 2611 2612 2613 2614 2615 2616 2617 2618 2701 2702 2703 2704
2705 2706
2707 2801 2802 2803 2804 2805 2806 2807 2808 2809 28
> 10 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823
2824 2825
2826 2827 2828 2829 2830 2831 2832 2833 2834 2835
>  2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848
2849 2850
2851 2852 2901 2902 2903 2904 2905 2906 2908 2910 2
> 911 2912 2913 2914

. qui foreach l of local levels {
r(2000);

end of do-file
r(2000);

>>> I guess that for at least one of your codes you
have insufficient observations. Missing values
on any of the variables would not help.

A work-around is to use -capture-

levels code, local(levels)
qui foreach l of local levels {
    capture regress rtnstk rtnmkt rtndla dlayen rtnyen if code ==`l'
    if _rc {
		di "code `l': error" _rc
    }
    else matrix cv`l' = get(VCE)
}

There is more at [P] capture or in the references in my previous
post in this thread.

Nick
[email protected]


*
*   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