%Macro loan2(PropType=,Price=); @RBRoma wrote: I have a dataset of real estate data. I created a macro that provides the means for credit score, interest rates, and down payment percentage based on the property type. How do I take the means of the outputs and create a new dataset that merges the four macro calls? SAS code attached. %IF &PropType = 1 %THEN %DO; PROC SORT data = loanapp; BY Branch; run; PROC MEANS Data = loanapp mean; VAR CreditScore Interest PercentDown; Where PropType = &PropType AND Price > &Price; By Branch; Title "Mean of Credit Score, Interest Rate, and Down Payment of Property Type &PropType greater than &Price Sale Price"; output out = loan_out; run; %end; %else %if &PropType ^= 1 %THEN %DO;; PROC MEANS Data = loanapp mean; VAR CreditScore Interest PercentDown; Where PropType = &PropType AND Price > &Price; Title "Mean of Credit Score, Interest Rate, and Down Payment of Property Type &PropType greater than &Price Sale Price"; output out=loan_out; run; %end; %Mend loan2; Data loanapp; set '/folders/myshortcuts/SAS/SAS HW #4/Data_Assignment4/loanapp.sas7bdat'; run; %loan2(PropType = 1, Price = 800000); %loan2(PropType = 2, Price = 800000); %loan2(PropType = 3, Price = 1000000); %loan2(PropType = 4, Price = 1200000);
... View more