I have a proc sql statement that I'm trying to check if a variable is null or not.
proc sql ;
create table x
as
select id, case when Search = 'Yahoo' then '<a href="www.yahoo.com">Yahoo</a>' || ' ' || ??????
quit ;
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
Thanks
when missing(variablename) then ...
would be the general approach
Ballardw,
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.
Thanks
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.
Ballardw,
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.
Thanks
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.