This is just a question of quoting the filename (and so compound-quoting the -write- statement)...
file write `wfile' `"View {view "`fname'"}"' _n
On a quick test, this appears to work.
David
[email protected]
-----Original Message-----
From: Fred Wolfe [mailto:[email protected]]
Sent: 13 February 2005 15:39
To: [email protected]
Subject: Re: st: macro - expansion problem
At 08:39 AM 2/13/2005, you wrote:
>can you put -char()- into this?
No, it doesn't work.
The problem is the ":". There doesn't seem to be a way to get " " around it
when you pass it from the file program into what will become a help file.
I found a work around: using \directory_name\ as opposed to c:\directory_name\
So it goes.
Thanks,
Fred
>On Sat, 12 Feb 2005 10:22:28 -0600, Fred Wolfe
><[email protected]> wrote:
> > I wonder if any Statalister might help me with this problem: using windows
> > xp, stata 8.2SE - up to date.
> >
> > I am passing a series of file descriptions to the -file- program in the
> > macro -fname-.
> >
> > They look like:
> >
> > c:\statdata\zoster\zoster.hlp
> > c:\statdata\analgesic\readme.txt
> >
> > <snip>
> > file open `wfile' using c:/ado/personal/projects.hlp, write replace
> > file write `wfile' "{smcl}" _n
> > foreach fname of local dirs {
> > file write `wfile' "View {view `fname'}" _n
> > }
> > <snip>
> >
> > After the program runs, I look in the created help file and see this:
> >
> > View \statdata\ADR\adr.hlp
> > View \statdata\adrepi\adrepi.hlp
> > View \statdata\back\backpain.hlp
> > View \statdata\back\fibro.hlp
> > View \statdata\back\utility.hlp
> > View \statdata\cancerfu\breastcancer.hlp
> > View \statdata\cancerfu\cancerfu.hlp
> > View \statdata\cancerfu\lungcancer.hlp
> >
> > When I click on one of these, I get the following:
> >
> > file c not found
> > request was:
> >
> > view c
> >
> > The ":" is being dropped and the path/file split apart.
> >
> > I would like to see:
> >
> > View c:\statdata\ADR\adr.hlp
> >
> > I have not been able to solve this problem with escape characters "\" or
> > macval() or any other text I could think of.
> >
> > Does anyone have any suggestions?
> >
> > Thanks
> >
> > Fred Wolfe
> >
> > Fred Wolfe
> > National Data Bank for Rheumatic Diseases
> > Wichita, Kansas
> > Tel (316) 263-2125 Fax (316) 263-0761
> > [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/
> >
>
>
>--
>Stas Kolenikov
>http://stas.kolenikov.name
>*
>* 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/
Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
Tel (316) 263-2125 Fax (316) 263-0761
[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/
*
* 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/