BookmarkSubscribeRSS Feed
skallamp
Obsidian | Level 7

Hi,

I am getting an error while calling the macro funcion in my proc SQL.

This query is working fine when i remove the &MAC_Markup_Value. part.

Can someone please help me to understand the error message and help me to resolve this.

%Let MAC_Markup_Value = 1.18;


PROC SQL;
  CREATE TABLE Claims_Join AS
  SELECT
    t1.*,
    t2.type,
    t2.gpi,
    t2.macunitcost_num,
    t2.Specialty_Ind,
    macunitcost_num * qty * &MAC_Markup_Value. as MAC
       
  FROM WORK.MAHEC_Claims AS t1
  LEFT JOIN WORK.SPECIALTY AS t2 ON (t1.ndc = t2.NDC)
  ;
QUIT;

Error Message
~~~~~~~~~~~~~~
WARNING: Apparent symbolic reference MAC_MARKUP_VALUE not resolved.
23            macunitcost_num * qty * &MAC_Markup_Value. as MAC
                                                            ___
                                                            22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,
              a missing value, BTRIM, INPUT, PUT, SUBSTRING, USER. 

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, ^=, |, ||, ~=. 

2 REPLIES 2
art297
Opal | Level 21

Your code ran perfectly on my machine.  Are you sure that you ran the initial %let statement?

ballardw
Super User

I also suggest that routinely ending your macro variable calls with the period is not best practice. You may run into hard to diagnose issues if you get involved with complex macro resolution.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1859 views
  • 0 likes
  • 3 in conversation