09-09-2015 05:20 PM
I am trying to load a dataset from the microsoft SQL server into SAS using Proc SQL (as shown below)
One of the variable name contains the "&" character, which SAS interpreted as a macro variable reference, giving out a warning message 'WARNING: Apparent symbolic reference B not resolved.'
I am wondering what would be the proper way to reference this variable. Apparently quoting the variable name as literal 'A&B Variable'n does not work in the Proc SQL setting as I've tried it.
proc sql; connect to sqlsvr(dsn=XXXX user=AAAA password=****); create table New as select * from connection to sqlsvr ( Select Base.[ID] as ID, Base.[A&B Variable] as AB_Var from InputDateSet as Base ); quit;
Thanks in advance for your help.
09-10-2015 01:35 AM
2 part solution
part 1: rename all similarly named columns in the database with names that will work over all environments (only use characters a-z, 0-9, underline)
part 2: shoot the one who had the spectacularly foolish idea to name a database column "A&B Variable"
just kidding about part 2, but part 1 will save you lots of grief in the future.
Need further help from the community? Please ask a new question.