{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


Titanium price 399 459 759 796 899 1130 1995 2256 this

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: n Track Road Mountain Frame CroMoly Aluminum Aluminum Aluminum Aluminum CroMoly Carbon Comp Titanium Price $399 $459 $759 $796 $899 $1,130 $1,995 $2,256 This program is fairly simple with only two calls to the macro, so you didn't save much by putting the PROC PRINT statements in a macro. But if you had many calls to the macro, you could simplify your program a great deal by using a macro. And, if you need to make a change to any of the PROC PRINT statements, if they are in a macro, then you would only need to make one change instead of trying to find every occurrence of the PROC PRINT and risk making mistakes. ADDING PARAMETERS TO MACROS Macros allow you to execute a set of SAS statements with just one statement, and while this alone can be helpful, macros are even more powerful when you add parameters to them. Parameters are macro variables whose values are set when you invoke the macro. Parameters give your macros flexibility. To add parameters to your macro, simply list the macro-variable names followed by an equal sign in parentheses after the macro name: %MACRO macro-name (parameter-1=, macro-text %MEND macro-name; parameter-2=, . . . parameter-n=); For example, if you have a macro named %MONTHLYREPORT that has parameters for the month and region, it might start like this: %MACRO monthlyreport (month=, region=); Then when you invoke the macro, specify the values for the macro variables after the equal signs: %monthlyreport (month=May, region=West) Because these macro variables are defined in the macro, they are, by default, local to the macro and you cannot use them in any SAS statements outside the macro. 5 SUGI 29 Tutorials Example The PRINTIT macro from the previous example prints the desired reports, but you have to sort the data between calls to the macro and the title does not reflect the sort order of the report. This new macro, SORTANDPRINT includes the PROC SORT statements and adds parameters so that you can vary both the sort variable and the sort sequence (descending or not). Then the ma...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online