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

Still struggling now with a slightly different syntax issue.  My program reads in the Rule variable as:

 

Rule:

NVL(A.INTER_SCF_EXCL_IND ,'T') <> NVL(B.INTER_SCF_EXCL_IND ,'T')

 

But the %PUT statement is still outputting a trucated version:

 

HERE!!! COALESCE(A.INTER_SCF_EXCL_IND ,'T') <> COALESCE(B.INTER_SCF_EXCL_IND ,

I'm so frustrated!

 

 

 

data QueryRules;
   infile datalines;
   input rule $70.;
   datalines;                      
NVL(A.INTER_SCF_EXCL_IND ,'T') <> NVL(B.INTER_SCF_EXCL_IND ,'T')
;

* Recodes to fix inconsistancies in Rule code so it will run on IBMs database and run using SAS instead of plsql ;
data QueryRules;
	set QueryRules;

	* SASs equiv of Oracles NVL function ;
	rule = tranwrd(rule,"NVL(", "COALESCE(");

run;

proc sql;
select trim(rule) into : rule_list separated by "#" from QueryRules;
quit;

%put HERE!!! &rule_list;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

The problem is a little different this time ... but it is something you might be able to figure out.  Just in case you want to work on it with that clue, I've moved the answer further down on the screen.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The length of your variable is $70.  That's fine when you start out.  But when you replace NVL with COALESCE, you need a longer variable.

View solution in original post

4 REPLIES 4
buechler66
Barite | Level 11
And with regard to the "#", I've tried it with no quotes, and single and double quotes. Grr....
Astounding
PROC Star

The problem is a little different this time ... but it is something you might be able to figure out.  Just in case you want to work on it with that clue, I've moved the answer further down on the screen.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The length of your variable is $70.  That's fine when you start out.  But when you replace NVL with COALESCE, you need a longer variable.

buechler66
Barite | Level 11

OMG!  I just wasn't even looking in that direction.  Thanks so much!

Reeza
Super User

@Astounding That's what the spoiler tag is for 🙂 The little guy hiding his face on the tool bar.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1546 views
  • 0 likes
  • 3 in conversation