DATA Step, Macro, Functions and more

macro quoting issue

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

macro quoting issue

Hello,

I think I have forgotten something basic. I am trying to loop through my macro code to create ten datasets. Below is my code. When I run it as is it runs fine but when I uncomment to run the macro code block then I get the missing quote error.

I am not sure how quotes work but I think SAS is adding a double quote somewhere and causing this macro to not work.

Any help appreciated. I have been manually running this 10 times )-:

Thanks!

 

libname data "H:\sasdata\eligibility";

options symbolgen mlogic serror merror mprint;

 

*%macro run_partition;

*%do ct=2 %to 4;

%let ct = 5;

%let st = &ct.000000000;

%let et = &ct.999999999;

%put &st.;

%put &et.;

 

%_eg_conditional_dropds(DATA.T0265_AG_IN_ELIG_P&ct);

PROC SQL;

CREATE TABLE DATA.T0265_AG_IN_ELIG_P&ct AS

SELECT

 

CASE_NUM

,PIN_NUM

,ELIG_RSLT_CD

,ELIGIBILITY_BEG_DT

,ELIGIBILITY_END_DT

,PAYMENT_BEGIN_DT

,PAYMENT_END_DT

FROM CKDB.T0265_AG_IN_ELIG

WHERE PIN_NUM > 0

AND PIN_NUM between &st and &et

AND CURRENT_ELIG_IND IN ('1','9')

AND PROGRAM_CD = 'CC'

AND SUBPROGRAM_CD NOT IN ('X','Z')

AND AG_SEQ_NUM > 0

AND CAG_ELIG_SEQ_NUM > 0

AND AG_STS_CD = 'O'

AND PAYMENT_BEGIN_DT <= '27nov2017'd

AND PAYMENT_END_DT >= '27nov2017'd

AND PAYMENT_BEGIN_DT <= PAYMENT_END_DT

AND PART_STS_CD = 'EA';

quit;

 

*%end;

*%macro run_partition;

*%run_partition

 


Accepted Solutions
Solution
‎11-27-2017 05:07 PM
Super User
Posts: 4,030

Re: macro quoting issue

You are missing a %MEND statement for your macro:

 

*%mend run_partition;

View solution in original post


All Replies
Solution
‎11-27-2017 05:07 PM
Super User
Posts: 4,030

Re: macro quoting issue

You are missing a %MEND statement for your macro:

 

*%mend run_partition;
New Contributor
Posts: 2

Re: macro quoting issue

Hello,

I am wondering now why it is not looping through 0 through 9 when I open up this macro statement:

 

%do ct=0 %to 9;

Super User
Posts: 4,030

Re: macro quoting issue

Comment or remove this statement:

 

%let ct = 5;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 142 views
  • 0 likes
  • 2 in conversation