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]

From |
tashi lama <ltashi32@hotmail.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: saving graph with a unique filename |

Date |
Fri, 20 Apr 2012 17:42:22 +0000 |

Absolutely correct, but my problem is little bit more complicated. The user will have a capacity to choose any no of arguments and I want to have all the strings in the arguments as a filename. I actually realise that `0' would represent all the strings but the catch is it will have spaces in between the strings. So, if my arguments are start_date end_date a b c then `0' would mean "start-date end_date a b c". And you can't have a filename with spaces in between. May be the solution is in parsing/deparsing the string. You think I can parse/deparse the string.. Thanx.. ---------------------------------------- > Date: Fri, 20 Apr 2012 18:25:10 +0100 > Subject: Re: st: saving graph with a unique filename > From: njcoxstata@gmail.com > To: statalist@hsphsun2.harvard.edu > > You can say > > tsline hits, saving(`start_date'`end_date', replace) > > Nick > > On Fri, Apr 20, 2012 at 6:19 PM, tashi lama <ltashi32@hotmail.com> 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/ * * 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/

**Follow-Ups**:**Re: st: saving graph with a unique filename***From:*Nick Cox <njcoxstata@gmail.com>

**References**:**st: saving graph with a unique filename***From:*tashi lama <ltashi32@hotmail.com>

**Re: st: saving graph with a unique filename***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: st: -cmp- does not work properly - wrong installation?** - Next by Date:
**Re: st: saving graph with a unique filename** - Previous by thread:
**Re: st: saving graph with a unique filename** - Next by thread:
**Re: st: saving graph with a unique filename** - Index(es):