BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SASAna
Quartz | Level 8

 

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

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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
;

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

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
;
SASAna
Quartz | Level 8
Thank you. it worked very well.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 560 views
  • 3 likes
  • 2 in conversation