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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 646 views
  • 0 likes
  • 2 in conversation