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]

Re: st: saving graph with a unique filename


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: saving graph with a unique filename
Date   Fri, 20 Apr 2012 18:25:10 +0100

You can say

 tsline hits, saving(`start_date'`end_date', replace)

Nick

On Fri, Apr 20, 2012 at 6:19 PM, tashi lama <[email protected]> wrote:
> Hello all,
>
>            I have a do file as follows
>
>
>
> /* begin example.do */
>
> args start_date end_date
>
> odbc query rr
>
> odbc load,exec("select distinct read_date as date, count(*) as hits from table1 where read_date between `start_date' and `end_date' group by read_date")
>
> tsset date
>
> list
>
> tsline hits, saving(*, replace)
>
>
>
>
>
> when you run
>
>  do example 01jan2010 03jan2010, you will get
>
>
>
>
>
>  date                 hits
>
> 01jan2010               4
>
> 02jan2010               5
>
> 03jan2010               9
>
>
>
>
>
> and of course the line graph. I would like to save the graph as a unique filename everytime I run it. One way I could think of doing that is save the graph with strings in the args as a filename. So,
>
> the graph in the example will be saved as 01jan201003jan2010.gph and if you run the stata like do example 01jan2011 31dec2011, the graph will be saved as 01jan201131dec2011.gph and etc...The problem
>
> is how do you do it? if args was a marco, then I could have said
>
>
>
>  tsline hits, saving(`args', replace)
>
> but, args isn't. Is there any way to have strings in arguments as filename and if there are other ways to create a unique file, please share...

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