|
**Hi, I am not sure what s wrong with this code. I have reviewed the the Command Syntax Reference.-CSR- .**trying to run a series of commands based on the year(!annee) selection .***********VarDef.sps contains at least: define !annee () '0506' !enddefine.
INCLUDE FILE='VarDef.sps'. ***********BASED on example on page 508 from the .-CSR-*******. DEFINE an56 () ECHO "year 0506 ". ECHO "sub-function for the year 0506 executed". !ENDDEFINE. DEFINE an23 () ECHO "year 0203 ". ECHO "sub-function pour l annee 0203 execute". !ENDDEFINE. *********************************************************. ************************CSR page 507 or 519*********. DEFINE !verify (year= !TOKENS(1)) !IF (!year = '0506') !THEN an56. !IFEND !IF (!year = '0405') !THEN an45. !IFEND !IF (!year = '0304') !THEN an34. !IFEND !IF (!year = '0203') !THEN an23. !IFEND !ENDDEFINE. !verify year = !annee. *********************************************************. _________________________________________________________________ Find a local pizza place, movie theater, and more….then map the best route! http://maps.live.com/default.aspx?v=2&ss=yp.bars~yp.pizza~yp.movie%20theater&cp=42.358996~-71.056691&style=r&lvl=13&tilt=-90&dir=0&alt=-1000&scene=950607&encType=1&FORM=MGAC01 |
|
Bonjour Mohammed,
The solution is to use define !annee () 0506 !enddefine. instead of define !annee () '0506' !enddefine. !IF (!year = '0506') is true (since '0506' means the string 0506 (without the quotes) When you use define !annee () '0506' !enddefine. !annee = '0506' with the quotes so the comparison !IF (!year = '0506') is TRUE.' When you use the first method, the variable !annee equals 0506 and the comparison !IF (!year = '0506') is effectively comparing 0506 (4 characters) with '0506' (6 characters) so the result is FALSE. **************** I find your approach complicated. As alternative approach consider, saving the macros in separate file with names such as an0506.SPS an0203.SPS etc and in you syntax use code such as INSERT FILE='VarDef.sps'. DEFINE !getMacro( annee=!TOKENS(1)) INSERT FILE=!QUOTE('an',!annee,'.SPS). !ENDDEFINE. !getMacro annee=!annee. Raynald Levesque www.spsstools.net On 8/9/07, Mohammed Iraqi <[hidden email]> wrote: > > **Hi, I am not sure what s wrong with this code. I have reviewed the the > Command Syntax Reference.-CSR- .**trying to run a series of commands based > on the year(!annee) selection .***********VarDef.sps contains at least: > define !annee () '0506' !enddefine. > INCLUDE FILE='VarDef.sps'. ***********BASED on example on page 508 from > the .-CSR-*******. DEFINE an56 () ECHO "year 0506 ". ECHO "sub-function for > the year 0506 executed". !ENDDEFINE. DEFINE an23 () ECHO "year 0203 ". ECHO > "sub-function pour l annee 0203 execute". !ENDDEFINE. > *********************************************************. > ************************CSR page 507 or 519*********. DEFINE !verify (year= > !TOKENS(1)) !IF (!year = '0506') !THEN an56. !IFEND !IF (!year = '0405') > !THEN an45. !IFEND !IF (!year = '0304') !THEN an34. !IFEND !IF (!year = > '0203') !THEN an23. !IFEND !ENDDEFINE. !verify year = !annee. > *********************************************************. > _________________________________________________________________ > Find a local pizza place, movie theater, and more….then map the best > route! > > http://maps.live.com/default.aspx?v=2&ss=yp.bars~yp.pizza~yp.movie%20theater&cp=42.358996~-71.056691&style=r&lvl=13&tilt=-90&dir=0&alt=-1000&scene=950607&encType=1&FORM=MGAC01 -- |
| Free forum by Nabble | Edit this page |
