run note there were 8 observations read from the

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: TANDPRINT): MPRINT(SORTANDPRINT): PROC PRINT DATA=models NOOBS; TITLE 'Current Models'; TITLE2 "Sorted by Class"; VAR Model Class Frame Price; FORMAT Price DOLLAR6.; RUN; NOTE: There were 8 observations read from the data set WORK.MODELS. NOTE: PROCEDURE PRINT used (Total process time): real time 0.09 seconds cpu time 0.00 seconds 18 RUN; You can see that SAS has inserted into the regular SAS log the MPRINT lines. The statements generated by the macro processor are all labeled with the word MPRINT followed by the name of the macro that generated the statements--in this case SORTANDPRINT. By using the MPRINT system option it is easy to see the standard SAS statements your macro is generating. CONDITIONAL LOGIC With macros and macro variables, you have a lot of flexibility. You can increase that flexibility still more by using conditional macro statements such as %IF. Here are the general forms of statements used for conditional logic in macros: 8 SUGI 29 Tutorials %IF condition %THEN action; %ELSE %IF condition %THEN action; %ELSE action; %IF condition %THEN %DO; action; %END; These statements probably look familiar because there are parallel statements in standard SAS code, but don't confuse these with their standard counterparts. These statements can only be used inside a macro, and can perform actions that would be completely impossible for standard SAS statements. With %IF, actions can include other macro statements or even complete DATA and PROC steps. Remember, the macro statements won't appear in the standard SAS code generated by the macro processor because you are writing a program that writes a program. Automatic macro variables Every time you invoke SAS, the macro processor automatically creates certain macro variables. You can use these in your programs. Two of the most commonly used automatic variables are Variable Name &SYSDATE &SYSDAY Example 31OCT03 Friday Description Character value of the date that job or session began Day of the week that job or session began Example The company maintains...
View Full Document

This note was uploaded on 03/21/2013 for the course AMS 597 taught by Professor Xing during the Spring '11 term at SUNY Stony Brook.

Ask a homework question - tutors are online