Datasets i and j have the labels and the data as follows.
filename i temp;
proc http url="http://faculty.tuck.dartmouth.edu/images/uploads/faculty/
rafael-laporta/Law_Fin.xls" out=i;
run;
proc import file=i dbms=xls replace out=i;
sheet="definitions";
getnames=no;
run;
proc import file=i dbms=xls replace out=j;
sheet="data";
run;The labels contain commas, percent signs, and unclosed parentheses as follows. How can I label the data correctly? The following macro incorrectly scans the macro strings due to empty spaces.
%macro i;
proc sql noprint;
select a,d into :i separated by "\",:j separated by "\" from i;
quit;
data j;
set j;
%do k=4 %to %sysfunc(countw(&i,\));
label %scan(&i,&k,\)="%scan(%nrbquote(&j),&k,\)";
%end;
run;
%mend;
%iThanks for help.
1. Try using %superq(j)
2. use proc datasets add add labels, do not copy the whole table.
1. Try using %superq(j)
2. use proc datasets add add labels, do not copy the whole table.
Also, it'd be a lot simpler to use call execute for this kind of endeavour.
Navigate AI governance with SAS tools for compliance and ethical AI practices. Try SAS Ai Navigator for free for the first six months.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.