10-05-2016 08:47 AM - edited 10-05-2016 08:48 AM
Please help! I am struggling to delete any spaces in the below code
data _null_; set want nobs = nobs ; call symput('nobs',nobs); stop; run ; %put &nobs; %Macro split (nobs); %do i = 1 %to &nobs ; Data _null_; length i 3 ; i = &i ; set Brands point=i; Call symput ('Dataset',Test); stop ; run; proc sql exec; create table &Dataset(keep = MISC_A_QTE_KEY &dataset:) select * from DAY_DATA where &Dataset._quote_commissionformula <> ' '; disconnect from odbc; quit; run; %end; %mend split; %split(&nobs);
If you can see the where statement in the proc sql statement , when I try to use a macro variable attached to a string(variable name) there are some trailing spaces in the macro variable which is giving me the follwing error.
73: LINE and COLUMN cannot be determined. NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred. ERROR 73-322: Expecting an AS. SYMBOLGEN: Macro variable DATASET resolves to ZE NOTE: Line generated by the macro variable "DATASET". 34 ZE _quote_commissionformula ________________________ 22 76 MPRINT(SPLIT): create table ZE (keep = MISC_A_QTE_KEY ZE :) select * from DAY_DATA where ZE _quote_commissionformula <> ' '; ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, +, -, '.', /, <, <=, <>, =, >, >=, AND, EQ, EQT, GE, GET, GROUP, GT, GTT, HAVING, LE, LET, LT, LTT, NE, NET, OR, ORDER, ^=, |, ||, ~=. ERROR 76-322: Syntax error, statement will be ignored.
As you can see above there is space after ZE . I have tried compbl,trim,compress and they didn't work. Please could somebody help me figure out this?
Also attached the dataset where the macro variables are feeding from.
Need further help from the community? Please ask a new question.