This question is from SAS Macro Language 1; Question : Reminder: Make sure you've defined the Orion library. Copy and paste the following macro into the editor. This macro creates a data set named Customer_Freq, which summarizes the variable Total_Retail_Price by Customer_ID. The data is sorted in descending order by the value of Sum. The call SYMPUTX routine creates a series of variables named Top1 through Topx, where x is the value of the Obs parameter. title;
footnote;
%macro tops(obs=3);
proc means data=orion.order_fact sum nway noprint;
var total_retail_price;
class customer_ID;
output out=customer_freq sum=sum;
run;
proc sort data=customer_freq;
by descending sum;
run;
data _null_;
set customer_freq(obs=&obs);
call symputx('top'||left(_n_), Customer_ID);
run;
%mend tops; Modify the macro to print a list of the top x customers from the orion.customer_dim data set. Display the variables Customer_ID, Customer_Name, and Customer_Type. Use a macro loop to dynamically generate values for the WHERE statement based on the macro variables Top1 through Topx. Call the macro with a null parameter value and view the results. my code: title; footnote; %macro tops( obs=3); proc means data=orion.order_fact sum nway noprint; var total_retail_price; class customer_ID; output out=customer_freq sum=sum; run; proc sort data=customer_freq; by descending sum; run; data _null_; set customer_freq(obs=&obs) ; call symputx('top'||left(_n_), Customer_ID); run; %do i = 1 %to &obs ; proc print data = orion.customer_dim; where Customer_ID = &&top&i ; run; %end ; %macro tops( obs=3); proc means data=orion.order_fact sum nway noprint; var total_retail_price; class customer_ID; output out=customer_freq sum=sum; run; proc sort data=customer_freq; by descending sum; run; data _null_; set customer_freq(obs=&obs) ; call symputx('top'||left(_n_), Customer_ID); run; %do i = 1 %to &obs ; proc print data = orion.customer_dim; where Customer_ID = &&top&i ; run; %end ; %mend tops; %tops(); My output is in a different format. Can someone help me to get the output in this format. Top 3 Customers Customer_ID Customer_Name Customer_Type 10 Karen Ballinger Orion Club members high activity 16 Ulrich Heyde Internet/Catalog Customers 45 Dianne Patchin Orion Club Gold members low activity
... View more