Hi All.. I am new in SAS and currently need a solution for my problem .. Here, I will explain about my issue with my sample data and process, kindly need your help. I have list of name : Name_without_space DWIEYUDOPRIHANTO STANISURYANTO SHERLYRITANANSY HERERAFENAROSSA I want to make a specific table for each name and then finally compile them in to one data set. So I wrote a macro like this: OPTIONS MPRINT; proc sql ; select distinct name_without_space into : name_list separated by ' ' from MyData ; quit; %macro dummy; %do i=0 %to %sysfunc(countw(&name_list)); %let next_name = %scan(&name_list, &i); %let value = %str(&next_name); %let code = %substr(&value,1,5); proc sql; create table cek_data_&code as select * from MyData where name_without_space = "&value" ; %end; quit; proc sql; create table compile_all as %do i=0 %to %sysfunc(countw(&name_list)); %let next_name = %scan(&name_list, &i); %let value = %str(&next_name); %let code = %substr(&value,1,5); %if i = %sysfunc(countw(&name_list)) %then %do; select * from cek_data_&code %end; %else %do; /*%until (i = %sysfunc(countw(&name_list)));*/ select * from cek_data_&code outer union corr %end; %end; ; quit; %mend; %dummy; It works until make a specific table for each list name, but then I got error when try to create table compile_all . The errors : ERROR 22-322: Syntax error, expecting one of the following: (, SELECT. Seems the error caused by the last part of query still get the "outer union corr" like this : select * from cek_data_HERER outer union corr ; Kindly need help, so I can compile all data sets into one datasets. Thanks in advance.
... View more