I don't know how to achieve to read table which has a special character # in the name and is being passed in as a macro parameter.
Here is a simple example:
%macro my_macro(p_lib=,p_table=);
proc contents data=&p_lib..&p_table. out=x; run;
%mend;
%my_macro(p_lib=tmp11, p_table=cso_list#703);
If I run that code it gives me an error:
33 tmp11.cso_list#703
_
22
200
ERROR 22-322: Syntax error, expecting one of the following: ;, (, CENTILES, DATA, DETAILS, DIR, DIRECTORY, FMTLEN, LIB, MEMTYPE,
I have tried using quotes and quotes for literal names. e.g.
proc contents data=&p_lib.."&p_table." out=x; run;
AND
proc contents data=&p_lib..'&p_table.'n out=x; run;
But nothing really works. What am I missing here?
If you have you want to use non-standard names for MEMBERS you first need to set the VALIDMEMNAME option to EXTEND. Then you can use a NAME LITERAL when referencing the dataset.
options validmemname=extend;
%let p_table=cso_list#703;
%let p_lib=tmp11;
proc contents data=&p_lib.."&p_table"n ;
run;
If you don't want to change the macro then make sure to pass member name as a name literal when you call the macro.
%my_macro(p_lib=tmp11, p_table='cso_list#703'n);
Are you really sure those are the names of your datasets? What type of engine is being used by the tmp11 libref? What do you see in the SAS log when you run this statement?
libname tmp11 list;