I am sorry about it. So this is the practice question I did: SAS Macro Language 1: Essentials--> 4.1 Defining and Calling a Macro--> Level 1, 2 practice question
I did nothing change on original code, and when I submit it, it always failed to generate results. Here are the original code and log message.
%let type=Gold;
title "&type Customers";
proc sql number;
select Name, Age_Group, Type
from mc1.customers
where Type contains "&type";
quit;
title;
OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 %let type=Gold;
74 title "&type Customers";
75 proc sql number;
76 select Name, Age_Group, Type
77 from mc1.customers
78 where Type contains "&type";
ERROR: Invalid characters were present in the data.
ERROR: An error occurred while processing text data.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
79 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
80 title;
81
82 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
94
I found the same problem for level 2 question, When I copy the answer code to my SAS Studio, it shows following message:
Solution:
%macro orderstats(var=Total_Retail_Price, class=Customer_ID,
stats=mean, decimals=2);
options nolabel;
title 'Order Stats';
proc means data=mc1.orders maxdec=&decimals &stats;
var &var;
class &class;
run;
title;
options label;
%mend orderstats;
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 %macro orderstats(var=Total_Retail_Price, class=Customer_ID,
74 stats=mean, decimals=2);
75 options nolabel;
76 title 'Order Stats';
77 proc means data=mc1.orders maxdec=&decimals &stats;
78 var &var;
79 class &class;
80 run;
81 title;
82 options label;
83 %mend orderstats;
84
85
86 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
Thanks so much! I am so stressed about this problem. I cannot continue my learning process due to this problem. Thanks again.
... View more