|
Dear colleagues!
I have the following syntax: *=========================== **** PARAMETERS**** ====================. *********************************************************************. DEFINE !Q() '2' !ENDDEFINE. *********************************************************************. DEFINE !PrQ() '1' !ENDDEFINE. *********************************************************************. DEFINE !path() "D:\AT_NacNN2008\Spss\" !ENDDEFINE. *====================================================================. GET TRANSLATE FILE=!path+"Nk"+!Q+".dbf" /TYPE=DBF /MAP. FILTER OFF. USE ALL. SELECT IF(stat='13' or stat='17' or stat='19' or stat='20'). EXECUTE . SAVE OUTFILE=!path+'Sample\xx.sav' /KEEP=num tsb week stat vid ansvid regteg ansregte dat3 ry errvid errregte /COMPRESSED. GET FILE=!path+'Sample\xx.sav'. INCLUDE FILE !Path+"Syntax\X"+!PrQ+".sps". *====================================================================. I should include different syntax depending on the parameter !PrQ (Previous Quarter)(X1.sps, X2.sps, or X3.sps). As I have defined a parameter for the Quarter (!Q) - can I calculate the previous Quarter (something like !Q-1), instead of defining it? I would be grateful if some of you could help me! Thank you in advance! With best regards! ===================== 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 |
|
Basically, you can't do arithmetic with the macro facility. It is a string parser only. However, I believe a very ugly solution exists that does do arithmetic, using !LENGTH(!BLANKS(PrQ)) or something like that ; see www.spsstools.net.
Much easier to make one simple Python function for this. Cheers!! Albert-Jan --- On Wed, 3/11/09, Boika Mileva <[hidden email]> wrote: > From: Boika Mileva <[hidden email]> > Subject: Can I make calculations with strings? > To: [hidden email] > Date: Wednesday, March 11, 2009, 11:13 PM > Dear colleagues! > > I have the following syntax: > > *=========================== **** PARAMETERS**** > ====================. > > *********************************************************************. > DEFINE !Q() > '2' > !ENDDEFINE. > *********************************************************************. > DEFINE !PrQ() > '1' > !ENDDEFINE. > *********************************************************************. > DEFINE !path() > "D:\AT_NacNN2008\Spss\" > !ENDDEFINE. > *====================================================================. > GET TRANSLATE > FILE=!path+"Nk"+!Q+".dbf" > /TYPE=DBF /MAP. > > FILTER OFF. > USE ALL. > SELECT IF(stat='13' or stat='17' or stat='19' or > stat='20'). > EXECUTE . > > SAVE OUTFILE=!path+'Sample\xx.sav' > /KEEP=num tsb week stat vid ansvid regteg ansregte > dat3 ry errvid > errregte /COMPRESSED. > > GET > FILE=!path+'Sample\xx.sav'. > > INCLUDE FILE !Path+"Syntax\X"+!PrQ+".sps". > *====================================================================. > > I should include different syntax depending on the > parameter !PrQ > (Previous Quarter)(X1.sps, X2.sps, or X3.sps). As I have > defined a > parameter for the Quarter (!Q) - can I calculate the > previous Quarter > (something like !Q-1), instead of defining it? > > I would be grateful if some of you could help me! > > Thank you in advance! > > With best regards! > > ===================== > 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 |
