Hi,
We are upgrading our SAS version from SAS 9.04.01.M3 to 9.04.01.M5. With the new Version EMAIL statement need pgm=SMTP coded to make the email work via CSSMTP.
I was trying to compare the version with the statement but not working properly.
Current SAS VERSION from SASVLONG IS 9.04.01M3P062415
Upgraded SAS VERSION FROM SASVLONG IS 9.04.01M5P091317
%PUT SAS VERSION IS &SYSVLONG ;
%GLOBAL EMAILPGM ;
%MACRO EMAIL_PGM_CHECKER;
%If &SYSVLONG >= '9.04.01M5AAAAAAA' %THEN
%LET EMAILPGM=PGM=SMTP ;
%MEND;
%EMAIL_PGM_CHECKER ;
%PUT EMAIL_PGM IS &EMAILPGM ;
With above statement even on current version 9.04.01M3 is also assigning the macro variable EMAILPGM=PGM=SMTP.
Please Advise how can i compare the version and assign the variable EMAILPGM with PGM=SMTP for latest version.
You are comparing a string that starts with the digit 9 to a string that starts with a single quote.
As the test below indicates digits appear after the single quote in ASCII collating sequence.
155 %if 9 > %str(%') %then %do; 156 %put 9 is larger than single quote; 9 is larger than single quote 157 %end; 158 %else %do; 159 %put 9 is NOT larger than single quote; 160 %end;
Perhaps you meant:
%If &SYSVLONG >= 9.04.01M5
But you will have issues if SAS comes out with a version 10 or a version 9.10 since both are less than 9.04 in ASCII collating sequence.
%if (%scan(&sysver,1,.) > 9) or (&sysver=9.04 and &sysvlong >= 9.04.01M5) %then %do;
...
%end;
@sathishthangamani wrote:
Hi,
We are upgrading our SAS version from SAS 9.04.01.M3 to 9.04.01.M5. With the new Version EMAIL statement need pgm=SMTP coded to make the email work via CSSMTP.
I was trying to compare the version with the statement but not working properly.
Current SAS VERSION from SASVLONG IS 9.04.01M3P062415
Upgraded SAS VERSION FROM SASVLONG IS 9.04.01M5P091317
%PUT SAS VERSION IS &SYSVLONG ;
%GLOBAL EMAILPGM ;
%MACRO EMAIL_PGM_CHECKER;
%If &SYSVLONG >= '9.04.01M5AAAAAAA' %THEN
%LET EMAILPGM=PGM=SMTP ;
%MEND;
%EMAIL_PGM_CHECKER ;
%PUT EMAIL_PGM IS &EMAILPGM ;
With above statement even on current version 9.04.01M3 is also assigning the macro variable EMAILPGM=PGM=SMTP.
Please Advise how can i compare the version and assign the variable EMAILPGM with PGM=SMTP for latest version.
> and < are seldom going to work as desired. And when you place unneeded characters it gets worse. The comparison you wrote compares the 9 in &syslong to the quote mark provided in '9.04.01M5AAAAAAA' so remove the quotes and see if you get expected behavior.
You are comparing a string that starts with the digit 9 to a string that starts with a single quote.
As the test below indicates digits appear after the single quote in ASCII collating sequence.
155 %if 9 > %str(%') %then %do; 156 %put 9 is larger than single quote; 9 is larger than single quote 157 %end; 158 %else %do; 159 %put 9 is NOT larger than single quote; 160 %end;
Perhaps you meant:
%If &SYSVLONG >= 9.04.01M5
But you will have issues if SAS comes out with a version 10 or a version 9.10 since both are less than 9.04 in ASCII collating sequence.
%if (%scan(&sysver,1,.) > 9) or (&sysver=9.04 and &sysvlong >= 9.04.01M5) %then %do;
...
%end;
Thank you so much Tom. This looks to be simple but have saved a lot of time of mine. Appreciated!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.