Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: saving file


From   "Abdel Rahmen El Lahga" <rahmen.lahga@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: saving file
Date   Thu, 12 Jul 2007 20:03:30 +0200

Thanks to Carole and Bill.
Carole's solution works fine but the Bill's suggestion dosn't work!!

2007/7/12, Carole J. Wilson <carolejwilson@gmail.com>:
--reply

Thank you, Bill, for the reminder about the braces.

My suggestion above should be amended to:
save "toto_${S_DATE}(`1'_`3'_`5')", replace

This obviates the need for the extra spaces (I couldn't figure out why
I needed them!).


--Carole

On 7/12/07, William Gould, StataCorp LP <wgould@stata.com> wrote:
> Abdel Rahmen El Lahga <rahmen.lahga@gmail.com> writes,
>
> > I would like to save file with date and time in file name, but I have
> > some trouble.
> > [...]
> >
> >        . save "toto$S_DATE.dta"
> >
> > Stata is ok and i obtain "file toto12 Jul 2007.dta saved"
> >
> >        . save "toto_$S_DATE_$S_TIME.dta"
> >
> > Stata gives the following message
> > file toto_19:04:26.dta could not be opened
>
> Abdel needs to type
>
>         . save "toto_${S_DATE}_${S_TIME}.dta"
>
> When Abdel typed "toto_$S_DATE_$S_TIME.dta" Stata took $S_DATE_ as the
> name of the first macro, and that substituted to nothing.  Putting in
> braces makes clear where macro names start and end.
>
> -- Bill
> wgould@stata.com
> *
> *   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/
>
*
*   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/


--
AbdelRahmen El Lahga
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index