Help using Base SAS procedures

PROC SQL NOPRINT default value

Accepted Solution Solved
Reply
Contributor
Posts: 42
Accepted Solution

PROC SQL NOPRINT default value

Hi,

 

Is there any way to have a default value for a PROC SQL NOPRINT if no matching row is found?

 

Thanks

 


Accepted Solutions
Solution
‎04-04-2017 12:11 PM
Super User
Posts: 10,550

Re: PROC SQL NOPRINT default value

I would say the easiest is to add

 

%let p_rate=1;

just before the proc sql. If a value is selected in the SQL then it wll overwrite the value assigned with the %let.

 

View solution in original post


All Replies
Super User
Super User
Posts: 7,430

Re: PROC SQL NOPRINT default value

Erm, the NOPRINT option stops SQL printing things to the log when there is just a select clause.  What exactly are you after, do you mean stop the procedure results, that is pretty default for all procedures?  

Contributor
Posts: 42

Re: PROC SQL NOPRINT default value

Thanks for the answer RW9

 

PROC SQL NOPRINT;
SELECT arn INTO: p_rate FROM rates WHERE MONTH(date) = MONTH("&chosendate."d);
QUIT;
RUN;

I am doing something like this. I use p_rate in the following like a calculation parameter.

If there is no matching rows, I would like p_rate to be equals to 1 by default...like this the rate won't have impact on the calculation.

Solution
‎04-04-2017 12:11 PM
Super User
Posts: 10,550

Re: PROC SQL NOPRINT default value

I would say the easiest is to add

 

%let p_rate=1;

just before the proc sql. If a value is selected in the SQL then it wll overwrite the value assigned with the %let.

 

Contributor
Posts: 42

Re: PROC SQL NOPRINT default value

This is so easy that I even didn't think to this! ^^ Thanks

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 458 views
  • 2 likes
  • 3 in conversation