If the column name has a single quote in it, you need to use literals, use double quotes and the n at the end.
test = "&test"n;
Assuming that at some point in this session you attempted to execute:
%let test = somestr'ng;
Everything from that point on is likely suspect as you did not complete the assignment to test. The first single quote "ate" the semicolon until the next single quote appeared in your session.
So without a posting from the log of submitted code AND the error message and preferably posted into a code box to prevent the forum message windows from reformatting text it does not help very much to post random snippets from the log.
If you are using the enhanced editor and have reasonable code highlighting settings the text should give a clue something is happening.
%let test = somestr'ng';
%let somethingelse=blah;
%let test = somestr'ng;
%let somethingelse=blah;
Notice that even the minimal highlighting in the code box shows the string enclosed with quotes in the first ling as a different color but in the third line with the single quote there is no highlight color. Indicates a quote issue.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.