|
Hi all I want to use the path of
the syntax file I am working with and subsequently use it as a macro value. Unfortunately the
command spss.SetMacroValue gives me a warning (Warning # 206 in column 23. Text: \ An invalid character
has been found on a command). I know this is due the several backlashes in a windows path ('\').
But is there a solution to avoid this warnings? I am using SPSS 15 on Windows XP. Thanks in advance Christian ***** begin code *****. BEGIN PROGRAM. import os,spss myPath =
os.getcwd() #print myPath spss.SetMacroValue("!Path",
myPath) END PROGRAM. Title !Path. ***** end code *****. ********************************** Christian Schmidhauser, Dr.phil.II |
|
You need to use quotes when you define the macro and then use !unquote when you reference it in SPSS code. There are a few other obscure characters besides \ that will cause this same warning. An alternative would be to map all your backslash characters to forward slash, since SPSS is happy with either. I had the same problem with the SPSSINC PROCESS FILES extension command and resorted to quoting the text even though that makes using the macro a little more complicated. However, unquoted text does not preserve case, so if you are on an os where file names are case sensitive, you could have a problem with that. Regards, Jon Peck SPSS, an IBM Company [hidden email] 312-651-3435
Hi all I want to use the path of the syntax file I am working with and subsequently use it as a macro value. Unfortunately the command spss.SetMacroValue gives me a warning (Warning # 206 in column 23. Text: \ An invalid character has been found on a command). I know this is due the several backlashes in a windows path ('\'). But is there a solution to avoid this warnings? I am using SPSS 15 on Windows XP. Thanks in advance Christian ***** begin code *****. BEGIN PROGRAM. import os,spss myPath = os.getcwd() #print myPath spss.SetMacroValue("!Path", myPath) END PROGRAM. Title !Path. ***** end code *****. ********************************** la volta statistics Christian Schmidhauser, Dr.phil.II Weinbergstrasse 108 CH-8006 Zürich Tel: +41 (043) 233 98 01 Fax: +41 (043) 233 98 02 email: mailto:schmidhauser@... Web: www.lavolta.ch |
|
Thanks Jon that
helped. I ended up with a
solution, in which I added the question marks in the SetMacroValue statement and repaksed the
backlashes with forward lashes. That worked Christian BEGIN PROGRAM. INSERT FILE =
!Path +
'/myInsert.sps' . **********************************
Christian
Schmidhauser, Dr.phil.II Von: SPSSX(r)
Discussion [mailto:[hidden email]] Im
Auftrag von Jon K Peck
|
| Free forum by Nabble | Edit this page |
