Hi SAS Users,
I am getting this below error, while reading a column from a excel( abc_short_desc has 3 byte character values, and they are looking fine when i read them) , Other columns are reading and creating the macro variables, just this one column is giving the error.
What i am missing?
PROC SQL NOPRINT;
24 SELECT &test_short_desc INTO :missdisc separated by '~'
NOTE: Line generated by the macro variable "TEST_SHORT_DESC".
24 abc_short_desc
___________
22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, ',', -, '.', /, <, <=, <>, =, >, >=, ?, AND, AS,
CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.
25 FROM miss_Data;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
26 %LET NO_PL=&sqlobs;
27 QUIT;
Thanks,
Ana
How did you create that macro variable?
What happens if you just type the actual name of the variable instead of trying to use the value of the macro variable as the name?
SELECT abc_short_desc
INTO :missdisc separated by '~'
FROM miss_Data
;
What happens if you add %unquote() to remove any macro quoting that might have been done to the content of the macro variable? A variable name should not need any macro quoting as it cannot include any "special" characters.
SELECT %unquote(&test_short_desc)
INTO :missdisc separated by '~'
FROM miss_Data
;
How did you create that macro variable?
What happens if you just type the actual name of the variable instead of trying to use the value of the macro variable as the name?
SELECT abc_short_desc
INTO :missdisc separated by '~'
FROM miss_Data
;
What happens if you add %unquote() to remove any macro quoting that might have been done to the content of the macro variable? A variable name should not need any macro quoting as it cannot include any "special" characters.
SELECT %unquote(&test_short_desc)
INTO :missdisc separated by '~'
FROM miss_Data
;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.