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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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