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;
%i
Thanks 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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.