I need to define a macro variable that can take three string literals. The string literals are separated by a pipe character ("|"), which is thus being used as an "OR" operator. The string literals are the full names of three people so present certain challenges when it comes to coding. The code I am having issues with is: %let string= John F\. Kennedy | %quote(John F. Kennedy, Jr.) | Kelly O'Donnell; As can be seen from the code snippet: 1) The first name has a period (.) so I "escaped" it using a backslash. No issues for me here. 2) The second name has a comma (,) so I enclosed the entire name in %quote(). Again, no issues for me here. 3) The third name has a single quote ('). I tried putting a backslash in front of the quote, or using the %quote() method. Neither of these methods work for me, and all code after the apostrophe is treated as one long string. How can I appropriately "escape" the single quote in the third name? The code snippet above is a part of the bigger code below. The code is attempting to look for the three names in the corporate filings of companies. data ncsr1; set wrdssec.wrds_forms; format FNAME2 $100. ;
where form = "N-CSR" and year(FDATE) = 2018;
FNAME2 = cats("/wrds/sec/wrds_clean_filings/",WRDSFNAME);
drop FINDEXDATE LINDEXDATE FNAME WRDSFNAME;
run;
%let string= John F\. Kennedy | %quote(John F. Kennedy, Jr.) | Kelly O'Donnell;
%let paragraph_length=0;
%TEXTPARSE(inset=ncsr1,outset=ncsr2,fname_full=fname2,tstr= &string, ln= ¶graph_length);
... View more