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

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

You are missing a %MEND statement for your macro:

 

*%mend run_partition;

View solution in original post

3 REPLIES 3
SASKiwi
PROC Star

You are missing a %MEND statement for your macro:

 

*%mend run_partition;
karnum
Calcite | Level 5

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;

SASKiwi
PROC Star

Comment or remove this statement:

 

%let ct = 5;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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