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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.