BookmarkSubscribeRSS Feed
nikolay_erney
Calcite | Level 5

What's wrong?

%macro bugs;
data person;
   infile datalines delimiter=',';
   input name $ dept $;
   datalines;                     
John,Sales
Mary,Acctng
;
run;
%mend;

%bugs;

1                                                          The SAS System                        17:16 Wednesday, September 26, 2012

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %_eg_hidenotesandsource;
17        
18         %macro bugs;
19         data person;
20            infile datalines delimiter=',';
21            input name $ dept $;
22            datalines;
23         John,Sales
24         Mary,Acctng
25         ;
26         run;
27         %mend;
28        
29         %bugs;

ERROR: The macro BUGS generated CARDS (data lines) for the DATA step, which could cause incorrect results.  The DATA step and the
       macro will stop executing.
NOTE: The data set WORK.PERSON has 0 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
     

ERROR: The macro BUGS will stop executing.
30        
31         %_eg_hidenotesandsource;
43        
44        
45         QUIT; RUN;
46        

But "

data person;

   infile datalines delimiter=',';

   input name $ dept $;

   datalines;                     

John,Sales

Mary,Acctng

;

run;

"

is correct!

1 REPLY 1
Doc_Duke
Rhodochrosite | Level 12

This is working as intended.  Macros are compiled before the data step is run so they can't have DATALINES statements and data.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 719 views
  • 1 like
  • 2 in conversation