|
On Thu, 1 Sep 2005 10:46:57 +0200, Luca Meyer <[hidden email]> wrote:
>It works, thank you Raynald! >Luca > >> -----Messaggio originale----- >> Da: Raynald Levesque [mailto:[hidden email]] >> Inviato: giovedì ± settembre 2005 3.22 >> A: [hidden email]; [hidden email] >> Oggetto: RE: Passing a macro variable to a script >> >> >> Hi Luca >> >> Try this (untested) code: >> >> DEFINE !Macro1 (Parameter1=!TOKENS(1)). >> GET FILE "C:\TEMP\TEMP.SAV". >> SCRIPT "C:\TEMP\TEMP.SBS" (!QUOTE(!Parameter1)). >> !ENDDEFINE >> >> HTH >> >> Raynald Levesque [hidden email] >> Visit my SPSS site: http://www.spsstools.net >> >> >> -----Original Message----- >> From: SPSSX(r) Discussion [mailto:[hidden email]]On >> Behalf Of Luca Meyer >> Sent: August 31, 2005 10:46 AM >> To: [hidden email] >> Subject: Passing a macro variable to a script >> >> >> Hi, >> >> Here I am trying to run something like: >> >> DEFINE !Macro1 (Parameter1=!TOKENS(1)). >> GET FILE "C:\TEMP\TEMP.SAV". >> SCRIPT "C:\TEMP\TEMP.SBS" ("!Parameter1"). >> !ENDDEFINE >> >> !Macro1 Parameter1=Q300. >> >> That is, by using the temp.sbs script I am trying to rename >> some variables by adding one prefix (in the specific case >> Q300 but it could vary) to the name of the variable. >> >> The script produces the correct rename syntax (thanks Neila >> for your suggestions!), but instead of the "Q300" value it >> takes "!Parameter1", that is the parameter value is not sent >> to the script...any suggestion on how I can correct the macro? >> >> Thanks, >> Luca >> >> Mr. Luca MEYER >> Survey research, data analysis & more: http://www.lucameyer.com/ >> Tel: +390122854456 - Fax: +390122854837 - Mobile: + 393394950021 >> >> "If you can't feed a hundred people, then feed just one." - >> Mother Teresa - www.thehungersite.com >> >> >> Hi, I am trying to do something similar but I want to pass a filepath from a macro to a script. Something like: set mprints on. DEFINE !Macro1 (Parameter1=!TOKENS(1)). SCRIPT "c:\mydirectory\myscript.SBS" (!QUOTE!Parameter1)). !ENDDEFINE !Macro1 Parameter1=C:\mydirectory\myfile.txt. The problem is SPSS doesn't like the colon. If I try the full server path I get a similar problem but with the slashes: !Macro1 Parameter1=\\servername\share\mydirectory\myfile.txt. What I'd actually like to do is set parameter1 to a filepath that I build up from Production Job macros. Something like !Macro1 Parameter1=!CONCAT("C:\",@mydirectory,"\",@myfile,".txt". where @mydirectory and @myfile are values passed via whatever the user types into the user prompts of the Production Job running the code. Any ideas??? >>> Error in line 4 of spssx-l.mailtpl: unknown formatting command <<< -> .................... <- |
|
Hi,
I am trying to do something similar but I want to pass a filepath from a macro to a script. Something like: set mprints on. DEFINE !Macro1 (Parameter1=!TOKENS(1)). SCRIPT "c:\mydirectory\myscript.SBS" (!QUOTE!Parameter1)). !ENDDEFINE !Macro1 Parameter1=C:\mydirectory\myfile.txt. The problem is SPSS doesn't like the colon. If I try the full server path I get a similar problem but with the slashes: !Macro1 Parameter1=\\servername\share\mydirectory\myfile.txt. What I'd actually like to do is set parameter1 to a filepath that I build up from Production Job macros. Something like !Macro1 Parameter1=!CONCAT("C:\",@mydirectory,"\",@myfile,".txt". where @mydirectory and @myfile are values passed via whatever the user types into the user prompts of the Production Job running the code. Any ideas??? ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Hi,
I tested this on a MS DOS script that I use sometimes: DEFINE !Macro1 (Param1=!cmdend) SCRIPT "D:\temp\dos_script.SBS" (!QUOTE(!Param1)). !ENDDEFINE. !macro1 param1 = dir d:\temp Not familiar enough with the Production Facility, but maybe the following works: define !macro1 (). !let !Parameter1 = !quote(!CONCAT("C:\",@mydirectory,"\",@myfile,".txt")). SCRIPT "D:\temp\dos_script.SBS" (!parameter1). !enddefine. HTH, AJ --- Lee <[hidden email]> wrote: > Hi, > I am trying to do something similar but I want to > pass a filepath from > a macro to a script. > > Something like: > > set mprints on. > > DEFINE !Macro1 (Parameter1=!TOKENS(1)). > SCRIPT "c:\mydirectory\myscript.SBS" > (!QUOTE!Parameter1)). > !ENDDEFINE > > !Macro1 Parameter1=C:\mydirectory\myfile.txt. > > The problem is SPSS doesn't like the colon. If I try > the full server path > I get a similar problem but with the slashes: > > !Macro1 > > > > What I'd actually like to do is set parameter1 to a > filepath that I build > up from Production Job macros. Something like > > !Macro1 > Parameter1=!CONCAT("C:\",@mydirectory,"\",@myfile,".txt". > > > where @mydirectory and @myfile are values passed via > whatever the user > types into the user prompts of the Production Job > running the code. Any > ideas??? > > ===================== > To manage your subscription to SPSSX-L, send a > message to > [hidden email] (not to SPSSX-L), with no > body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send > the command > INFO REFCARD > Cheers! Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ____________________________________________________________________________________ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by Lee-63
Hi Lee,
The following works (tested): DEFINE !Macro1 (Parameter1=!TOKENS(1)). SCRIPT "c:\mydirectory\myscript.SBS" (!Parameter1). !ENDDEFINE. !Macro1 Parameter1 = "C:\mydirectory\myfile.txt". Hope this helps, Christian ******************************* 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:[hidden email] internet: http://www.lavolta.ch/ -----Ursprüngliche Nachricht----- Von: SPSSX(r) Discussion [mailto:[hidden email]]Im Auftrag von Lee Gesendet: Dienstag, 16. Oktober 2007 14:53 An: [hidden email] Betreff: Re: R: Passing a macro variable to a script Hi, I am trying to do something similar but I want to pass a filepath from a macro to a script. Something like: set mprints on. DEFINE !Macro1 (Parameter1=!TOKENS(1)). SCRIPT "c:\mydirectory\myscript.SBS" (!QUOTE!Parameter1)). !ENDDEFINE !Macro1 Parameter1=C:\mydirectory\myfile.txt. The problem is SPSS doesn't like the colon. If I try the full server path I get a similar problem but with the slashes: !Macro1 Parameter1=\\servername\share\mydirectory\myfile.txt. What I'd actually like to do is set parameter1 to a filepath that I build up from Production Job macros. Something like !Macro1 Parameter1=!CONCAT("C:\",@mydirectory,"\",@myfile,".txt". where @mydirectory and @myfile are values passed via whatever the user types into the user prompts of the Production Job running the code. Any ideas??? ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
