Summary of Formatting Variable Values Temporarily Formatting Values The FORMAT statement, when used in a SAS procedure, associates a particular format with one or more variables Formats assigned in this way will remain in effect only for the current processing step
Creating Crosstabulations - Question 1 Complete the program below so that PROC FREQ creates a two-way crosstabulation of AgeRange and MovingViolation Use the values of MovingViolation for the table rows proc freq data=insure auto; run;
Selecting Variables When you create a new data set, you can use options to drop or keep variables that are stored in the original data set You name the variables you want to drop or keep by using the DROP= and KEEP= data set options
Selecting Statistics and Variables (3) By default, PROC MEANS output uses the BEST format This can result in unnecessary decimal places, making your output hard to read To limit decimal places, use the MAXDEC= option in the PROC MEANS statement and set it equal to the length you prefer General form, PROC MEANS statement with MAXDEC= option: PROC MEANS < DATA = SAS-data-set> < statistic-keyword (s) > MAXDEC=n;
Selecting Variables (1) General form, DROP= and KEEP= data set options: (DROP=variable-1 < variable-n>) (KEEP=variable-1 < variable-n>) where the DROP= or KEEP= option, in parentheses, follows the name of the data set containing the variables to be dropped or kept variable is the name of one or more variables, separated by blanks
Formatting Variable Values For example, the FORMAT statement below writes values of the variable Fee using dollar signs, commas, and no decimal places: proc print data=clinic admit; var actlevel fee; where actlevel='HIGH'; format fee dollar4 ; run;
Preparing Data for Match-Merging (2) the DATA= option names the data set to be read the OUT= option creates an output data set containing the data in sorted order variable (s) in the required BY statement specifies the variable (s) whose values are used to order the data
Using Automatic Macro Variables (1) This section teaches you how to use automatic macro variables in your programs After completing this section, you will be able to identify the type of information provided by automatic macro variables reference an automatic macro variable identify when automatic macro variable references are resolved Automatic Macro Variables Whenever you invoke the SAS System, automatic macro variables are