The general form of Proc tabulate: (the subject is different from the freq process. Here is the table statement, not tables)
1 proc tabulate format = options;/* format = option to change the format of all cells in the table */2 var analysis-variable-list; 3 class classification-variable-list; /* the variables in the following Table statement must appear in the VaR statement or class in advance */4 Table Page-dimension, row-dimension, column-dimension/box = option misstext = option; 5/* box = option specifies the sentence in the space in the upper left corner of the output tabulate report; misstext = the option assigns a specific value to the empty data cells */6 run;
Note:
- VaR statement: In addition to listing variable names, the VaR statement can also contain statistics, such as: All (sum in this dimension), Max, Min, mean, median, mode, n, nmiss, pctn, pctsum, stddev, Sum.
- TABLE statement of the same latitude variable concateting, crossing, and grouping:
1 concatenating: simply list them separated by a space; 2 crossing: List variables or keywords separated by an *; 3 grouping: List variables or keywords in parentheses
1.keyword ALL is generally concatenated; 2. To request other statistics, cross the keyword with the variable name.
Example:
1 Data boats; 2 infile 'C: \ myrawdata \ boat. dat '; 3 input name $1-12 port $14-20 locomotion $22-26 type $28-30 price 32-36; 4 run; 5 * Changing headers; 6 proc format;/* if you want to change the title of the class variable value, Step 1: use this format statement to define the new format */7 value $ typ 'cat' = 'catamaran '8' Sch '= 'shanghai' 9 'yac' = 'yacht'; 10 run; 11 12 proc tabulate data = boats format = dollar9.2; 13 class locomotion type; 14 var price; 15 format type $ typ .; 16 Table locomotion = ''all,/* change the variable title */17 mean = ''' * price = 'mean price by type of Boat' * (type = ''all) /box = 'full day excursions 'misstext = 'none';/* change the keyword title */18 title; 19 run;
Note:
- Change the title of the output table of Proc tabulate
- Title formed by changing the classification value of the class variable: defines a new format through this format, and then assigns a value to this classification variable through the format statement;
Change the title of a variable or Keyword: connect the variable or keyword with the new title equal sign enclosed in single quotes. In particular, if the variable is '', the title is deleted.