Could someone help me how I can get a macro variable updated with single quotes.
I am getting numbers as comma separated values from a Dataset like below:
2108008080, 2108008081, 2108888082, 2108858090, 213856345 etc I have to pass each of these records in a SQL where condition as Phone_numbers in (¤t_macro_variable). To do this I have to add single quotes around each value as the Phone_numbers columns is a character field of Oracle DB.
Any help is highly appreciated. I could not get much help from SAS communities.
Did you try the CATQ()
function? Use the 1
modifier to generate single quotes. Use the a
modifier to get all terms quoted. Use the c
modifier to generate commas as the output delimiter.
%let x=2108008080, 2108008081, 2108888082, 2108858090, 213856345;
%put %sysfunc(catq(1ac,&x));
Which produces:
'2108008080','2108008081','2108888082','2108858090','213856345'