DATA Step, Macro, Functions and more

macro

Reply
Contributor
Posts: 67

macro

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)

 

Contributor
Posts: 67

Re: macro

Posted in reply to zhuxiaoyan1

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

Super User
Posts: 13,556

Re: macro

Posted in reply to zhuxiaoyan1

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.

Ask a Question
Discussion stats
  • 2 replies
  • 99 views
  • 0 likes
  • 2 in conversation