How to print the cecode that corresponds to &&var&i?
What happens is that i is taking the next value instead of the current value.
say &&var&i for i=1 resolves to 'AMPS' and for i=2 resolves to 'ACOP'. i want to print cecode as 'AMPS' when it reads values from AMPS dataset ,ACOP when it reads values from ACOP dataset in ref library.The records are appended in the set statement and a final dataset vir is created.
%do i=1 %to &nobs.;
Where is &nobs assigned - also, is it intentional that you have reference to &i outside your %DO loop? Lastly, suggest adding this code to help SAS generate the most diagnostics output for your desk-checking with SAS compilation:
And, with the above code added, suggest the OP re-post a reply with the SAS-generated log output revealed, not just the code-piece -- presuming the problem is still not solved with additional log diagnostics info.