Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: concatenating macros


From   <dankwart.plattner@kfw.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: concatenating macros
Date   Fri, 12 Nov 2004 17:49:15 +0100

I encountered the same problem when programming -rfl-.
Here is how I have managed to solve it:

			if substr(`"`logstr`=`i'-1''"',-1,1) == "\" {
				local cmdlog `cmdlog'\`logstr`i''
			}
			else {
				local cmdlog `cmdlog'`logstr`i''
			}
This never failed to work properly.
Dankwart


Original message was:
Hi all:
I’m working within the Windows2000 OS and am having trouble getting paths
and filenames stored in local macros properly.
.local pathvar "F:\CELS\"
.local filename "35051403"
.local longname `pathvar'`filename'

.di “`longname’”
F:\CELS35051403    ←Stata output

The problem is that the final \ gets dropped from the path.

.di "`pathvar'"
F:\CELS\

Oddly, the initial macro seems to store this correctly

Changing the longname macro construction to...
.local longname `pathvar'`filename'
.di “`longname’”
F:\CELS35051403

...no effect

Any suggestions?

John Wallace | Research Associate | Test Method Development


------------------------------------------------------------------------------------
Disclaimer
Die in dieser E-Mail und den dazugehoerigen Anhaengen (zusammen die "Nachricht") enthaltenen 
Informationen sind nur fuer den Adressaten bestimmt und koennen vertrauliche und/oder rechtlich 
geschuetzte Informationen enthalten. Sollten Sie die Nachricht irrtuemlich erhalten haben, loeschen 
Sie die Nachricht bitte und benachrichtigen Sie den Absender, ohne die Nachricht zu kopieren oder 
zu verteilen oder ihren Inhalt an andere Personen weiterzugeben.

Ausser bei Vorsatz oder grober Fahrlaessigkeit schliessen wir jegliche Haftung fuer Verluste oder 
Schaeden aus, die durch virenbefallene Software oder E-Mails verursacht werden.
------------------------------------------------------------------------------------
Disclaimer
The information contained in this e-mail and any attachments (together the "message") is intended 
for the addressee only and may contain confidential and/or privileged information. If you have 
received the message by mistake please delete it and notify the sender and do not copy or 
distribute it or disclose its contents to anyone.

Except in case of gross negligence or wilful misconduct we accept no liability for any loss or 
damage caused by software or e-mail viruses.
------------------------------------------------------------------------------------


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