Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: ado file


From   tashi lama <[email protected]>
To   <[email protected]>
Subject   st: ado file
Date   Mon, 13 Aug 2012 15:48:51 +0000

I am writing a simple ado-file where I am generating a dataset using sql query and listing the variable using syntax command. Here is my code 
clear
program dd 
qui odbc query indigo_dev71
odbc load, exec("select date(read_date) as date, count(*) as hits from readership where source_id=6429 and date(read_date) between '2011-01-01' and '2011-01-20' group by date(read_date)")
syntax [varlist]
list `varlist'
end
exit

when I execute ado file    .dd date hits 
         date    hits |
     |------------------|
  1. | 01jan2011    127 |
  2. | 02jan2011    315 |
  3. | 03jan2011   4438 |
  4. | 04jan2011   3978 |
  5. | 05jan2011   3896 |
     |------------------|
  6. | 06jan2011   4981 |
  7. | 07jan2011   4310 |
  8. | 08jan2011    540 |
  9. | 09jan2011    567 |
 10. | 10jan2011   5572 |
     |------------------|
 11. | 11jan2011   4261 |
 12. | 12jan2011   4184 |
 13. | 13jan2011   4218 |
 14. | 14jan2011   4894 |
 15. | 15jan2011   1113 |
     |------------------|
 16. | 16jan2011    343 |
 17. | 17jan2011   1154 |
 18. | 18jan2011   3981 |
 19. | 19jan2011   5669 |
 20. | 20jan2011   3685 |

Great. But when I run second time  .dd date 
Stata returns you must start with an empty dataset. I have a "clear" command at the top of my adofile to start with a fresh memory. Could someone please explain? Also, does adofile name have to be identical to the program name? Meaning, my program name here is dd. Do I have to have a adofile dd.ado? If they could be different, how do I execute? 

Thanx..
Tashi  		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index