BookmarkSubscribeRSS Feed
zhuxiaoyan1
Quartz | Level 8

I have the following programs:. The nonmacro part works but the macro doesn't work. This is the note from log:

Table WORK.ETG_999900 created, with 0 rows and 5 columns. I can't figure out why it gives me nothing. Any suggestions/solutions will be greatly appreciated!

libname Store "\\nasnpmmds\EBI1\mmds\AHCPII\OPTUMCheck";

PROC SQL;

CREATE TABLE WORK.ETG_999900 AS

SELECT t1.ETG_NBR,

 

t1.EPI_TYPE_KEY,

t1.EPI_NBR,

/* DESC */

('Orphan Record') AS DESC,

/* Short_ETG */

(substr(t1.ETG_NBR, 1, 6)) AS Short_ETG

FROM store.lost_claims_91 t1

WHERE (CALCULATED Short_ETG) = '999900'

ORDER BY t1.EPI_TYPE_KEY,

 

t1.EPI_NBR;

QUIT;

%macro ETG(DESC, ETG);

 

PROC SQL;

CREATE TABLE WORK.ETG_&ETG AS

SELECT t1.ETG_NBR,

t1.EPI_TYPE_KEY,

t1.EPI_NBR,

/* DESC */

('&DESC') AS DESC,

/* Short_ETG */

(substr(t1.ETG_NBR, 1, 6)) AS Short_ETG

 

FROM Store.lost_claims_91 t1

WHERE (CALCULATED Short_ETG) = '&ETG'

 

ORDER BY t1.EPI_TYPE_KEY,

t1.EPI_NBR;

QUIT;

%mend ETG;

%ETG(Orphan Record, 999900)

 

2 REPLIES 2
zhuxiaoyan1
Quartz | Level 8

I just figured out why my macro did not work. I have to use " " instead of ' '.

ballardw
Super User

@zhuxiaoyan1 wrote:

I just figured out why my macro did not work. I have to use " " instead of ' '.


Mark this post as the "solution" so folks know the issue was answered.

 

In the future please post code and/or log text into a code box such as is opened with the forums {I} or "running man" icon.

 

the code boxes will preserve formatting (indenting and such) and make things easier to read. Also many error messages have indicators where the error is recognized by SAS but the main message windows will reformat text to move the diagnostic characters.

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
  • 704 views
  • 0 likes
  • 2 in conversation