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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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