12-18-2017 11:45 AM - last edited on 12-18-2017 12:44 PM by ChrisHemedinger
I applied the code provided in this topic to convert character variable to numeric, it works quite well for individual data sets.But when I apply the code in macro, I meet problems. When I use "proc sql" to find out character variables in data sets, SAS tells me that there are no character variables in the data sets but actually there are some. I don't know why, so could you kindly help me out?
%macro sic2_state(i,j); data &j&i; set &j&i; run; proc sql; create table char_cur&j&i as select name from dictionary.columns where libname='WORK' and MEMNAME="&j&i" and type='char'; quit; %mend; %sic2_state(1999,Connecticut) %sic2_state(1999,Florida) %sic2_state(1999,Indiana) %sic2_state(1999,Tennessee)
Thanks a lot! Cheers, Owen
12-18-2017 01:01 PM
Within dictionary.columns, all the MEMNAME values are stored in uppercase. So the initial hurdle to overcome is to change the MEMNAME criterion to:
and memname = upcase("&j&i")