There is a question: Create a Macro variable for Dallas in the Location variable of Data: ALL. Use this macro variable to subset the ‘ALL’ excel data inside the proc SQL to select variables student_name, teacher, fee, days, paid, location. Write a Proc SQL query to find the ‘average fee’ and ‘total fee’ by ‘paid’ variable for Dallas. This data set of All is like: Using this following Proc SQL procedure the goal is easily achieved: Proc SQL; Select student_name, fee, days, paid, location, mean(fee) as avg_fee label = 'average fee', sum(fee) as tot_fee label = 'total fee' From All Where location = 'Dallas' and Paid = 'Y'; Quit; However, when I tried to use the following code to create a macro variable to subset the location variable into 'Dallas', it did not work: Proc SQL; Select student_name, fee, days, paid, mean(fee) as avg_fee label = 'average fee', sum(fee) as tot_fee label = 'total fee', location into :Dallas From All Where Paid = 'Y'; Quit; Would someone like to kindly show me how I should create the macro variable so as to subset the location variable successfully? Thank you!
... View more