04-09-2013 04:12 PM
I have a proc sql statement that I'm trying to check if a variable is null or not.
proc sql ;
create table x
select id, case when Search = 'Yahoo' then '<a href="www.yahoo.com">Yahoo</a>' || ' ' || ??????
At this point I want to replace ?????? with a way to check my variable to see if there is data or not. If there is I want to add more text if not then continue to the next step.
I want to add brackets around my value if it isn't null.
Ex. The variable has data : Yahoo [Bob]
Ex. The variable no data : Yahoo
04-09-2013 04:37 PM
Thanks for the reply. Would that when belong to another case statement?
Within this contatnation i'm doing there will be multiple variables that could be null and if they are I don't want the text that identifies them to display. I want it to display only if there is data.
04-09-2013 05:59 PM
Another case statement at this point. I'm not sure how many levels of nesting SAS SQL will handle. It may be worth looking into a datastep at least for manipulating the individual variables to have the  or whatnot done to them and then an appropriate CATX CATS or whichever to concatenate them into one variable to insert in to the final string.
04-10-2013 08:43 AM
Thank you so much. I'm going to start out the morning trying to use a data step. I think with an if statement and catx or cats I can get it working that way.
I will reply my results.