BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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;

View solution in original post

3 REPLIES 3
ballardw
Super User

@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.

 

Tom
Super User Tom
Super User

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
Calcite | Level 5

Thank you so much Tom. This looks to be simple but have saved a lot of time of mine. Appreciated!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 3 replies
  • 1068 views
  • 1 like
  • 3 in conversation