SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

WARNING Extraneous text on %MEND statement ignored

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 17
Accepted Solution

WARNING Extraneous text on %MEND statement ignored

[ Edited ]

I keep getting this error message with the code detailed below:

 

%LET NAME= sup1_Fac_pat_demo_chisq;
WARNING: Extraneous text on %MEND statement ignored for macro definition EASY4.
10679 %LET NAMES= sup0_Fac_pat_demo_chisq;
10680 data compare_vs_nvs;
10681 set %easy3 %easy4;
MPRINT(EASY3): data sup1_Fac_pat_demo_chisq (keep = sex newrace2 livingage_new2014 risk status);
ERROR: File WORK.DATA.DATA does not exist.
MPRINT(EASY3): set sup1_Fac_pat_demo2;
MPRINT(EASY3): status="VS at Elmhurst Hospital Center";
MPRINT(EASY3): run;

 

CODE:  

 


*VS/not VS;
%LET NAME= sup1_Fac_pat_demo_chisq;
%LET NAMES= sup0_Fac_pat_demo_chisq;


%macro easy3;
data &NAME (keep = sex newrace2 livingage_new&year. risk status); set sup1_Fac_pat_demo2;
status="VS at &Facility_X"; run;
%mend;

 

%macro easy4;
data &NAMES (keep = sex newrace2 livingage_new&year. risk status); set sup0_Fac_pat_demo2;
status="not VS at &Facility_X"; run;
%mend

 

%LET NAME= sup1_Fac_pat_demo_chisq;
%LET NAMES= sup0_Fac_pat_demo_chisq;
data compare_vs_nvs;
set %easy3 %easy4;
run;

 

 

 

 

 


Accepted Solutions
Solution
‎06-28-2017 11:07 AM
Super User
Posts: 10,516

Re: Error Messages

From your log entry:

 set %easy3 %easy4;
MPRINT(EASY3): data sup1_Fac_pat_demo_chisq (keep = sex newrace2 livingage_new2014 risk status);
ERROR: File WORK.DATA.DATA does not exist.

 

 set %easy3 %easy4;

Generates this code (at least in part from %easy3):

set data sup1_Fac_pat_demo_chisq (keep = sex newrace2 livingage_new2014 risk status);

Which says that there should be a dataset name data somewhere to read. That is the proximate cause of the error message because you do not currently have a data set named Data in your default work library.

Then the second data set sup1_Fac_pat_demo_chisq is expected to be read with the listed variables kept. The remaining statements from %easy3 are syntactically correct but likely not what you meant to do.

View solution in original post


All Replies
Super User
Posts: 5,085

Re: Error Messages

[ Edited ]

There's a missing semicolon after:

 

%mend

 

We've all done that at one time or another.

 

You should add OPTIONS MPRINT;

 

That way, you can see the code that is generated.  You would realize that this is not correct:

 

set data sup1_Fac_pat_demo_chisq (keep = sex newrace2 livingage_new2014 risk status);

 

You don't have a data set named "data" to bring in.

Occasional Contributor
Posts: 17

Re: Error Messages

I still get the same error messages

Super User
Posts: 5,085

Re: Error Messages

Yes, you will still get the same errors.  (The Warning should be gone, however.)

 

These changes don't fix the errors.  They merely let you examine the log to see the flaws in your program.  They are many, and substantial, and will force you to learn more about macro language to correct them.  So the first lesson is this.  You have to read the log and try to see why the errors are occurring.  The second is this.  Macro language is not processing your data.  It is building a program.  So when you code this:

 

set %easy3 %easy4;

 

Your expectations of what should happen are not correct.  %EASY3 does not create a data set that becomes part of the SET statement.  Instead, %EASY3 generates SAS code that adds to the SET statement.  So does %EASY4.  So this SET statement adds the generated text, and becomes:

 

set

data sup1_Fac_pat_demo_chisq (keep = sex newrace2 livingage_new&year. risk status); set sup1_Fac_pat_demo2;
status="VS at &Facility_X"; run;

data sup1_Fac_pat_demo_chisq (keep = sex newrace2 livingage_new&year. risk status); set sup0_Fac_pat_demo2;
status="not VS at &Facility_X"; run;

 

Clearly, this is not your intention as to what your SET statement should look like, nor is it a working program.  But seeing this in your log should at least guide you into making changes.

Super User
Posts: 5,257

Re: Error Messages

Show the new log.
Data never sleeps
Occasional Contributor
Posts: 17

Re: Error Messages

data sup1_Fac_pat_demo_chisq (keep = sex newrace2 livingage_new2014 risk status);
ERROR: File WORK.DATA.DATA does not exist.
MPRINT(EASY3): set sup1_Fac_pat_demo2;
MPRINT(EASY3): status="VS at Elmhurst Hospital Center";
MPRINT(EASY3): run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.COMPARE_VS_NVS may be incomplete. When this step was stopped there were
0 observations and 24 variables.
WARNING: Data set WORK.COMPARE_VS_NVS was not replaced because this step was stopped.
Super User
Posts: 5,257

Re: Error Messages

The full log please so we can see the code.
Data never sleeps
Occasional Contributor
Posts: 17

Re: Error Messages


10745
10746 %macro easy3;
10747 data &NAME (keep = sex newrace2 livingage_new&year. risk status); set sup1_Fac_pat_demo2;
10748 status="VS at &Facility_X"; run;*/Bright:641;
10749 %mend;
10750
10751 %macro easy4;
10752 data &NAMES (keep = sex newrace2 livingage_new&year. risk status); set sup0_Fac_pat_demo2;
10753 status="not VS at &Facility_X"; run;*/Bright:248;
10754 %mend;
10755
10756 %LET NAME= sup1_Fac_pat_demo_chisq;
10757 %LET NAMES= sup0_Fac_pat_demo_chisq;
10758 data compare_vs_nvs;
10759 set %easy3 %easy4;
MPRINT(EASY3): data sup1_Fac_pat_demo_chisq (keep = sex newrace2 livingage_new2014 risk status);
ERROR: File WORK.DATA.DATA does not exist.
MPRINT(EASY3): set sup1_Fac_pat_demo2;
MPRINT(EASY3): status="VS at Elmhurst Hospital Center";
MPRINT(EASY3): run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.COMPARE_VS_NVS may be incomplete. When this step was stopped there were
0 observations and 24 variables.
WARNING: Data set WORK.COMPARE_VS_NVS was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds


MPRINT(EASY3): */Bright:641;
MPRINT(EASY4): data sup0_Fac_pat_demo_chisq (keep = sex newrace2 livingage_new2014 risk status);
MPRINT(EASY4): set sup0_Fac_pat_demo2;
MPRINT(EASY4): status="not VS at Elmhurst Hospital Center";
MPRINT(EASY4): run;

NOTE: There were 84 observations read from the data set WORK.SUP0_FAC_PAT_DEMO2.
NOTE: The data set WORK.SUP0_FAC_PAT_DEMO_CHISQ has 84 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds

Super User
Posts: 5,085

Re: Error Messages

Two questions, at this point, concerning SET %EASY3 %EASY4;:

 

(1) Can you see in the log where the first word after "SET" is "DATA" which is not the name of an existing data set?

(2) What are you expecting SET %EASY3 %EASY4; to actually do?

Solution
‎06-28-2017 11:07 AM
Super User
Posts: 10,516

Re: Error Messages

From your log entry:

 set %easy3 %easy4;
MPRINT(EASY3): data sup1_Fac_pat_demo_chisq (keep = sex newrace2 livingage_new2014 risk status);
ERROR: File WORK.DATA.DATA does not exist.

 

 set %easy3 %easy4;

Generates this code (at least in part from %easy3):

set data sup1_Fac_pat_demo_chisq (keep = sex newrace2 livingage_new2014 risk status);

Which says that there should be a dataset name data somewhere to read. That is the proximate cause of the error message because you do not currently have a data set named Data in your default work library.

Then the second data set sup1_Fac_pat_demo_chisq is expected to be read with the listed variables kept. The remaining statements from %easy3 are syntactically correct but likely not what you meant to do.

☑ This topic is SOLVED.

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

Discussion stats
  • 9 replies
  • 1278 views
  • 0 likes
  • 4 in conversation