merge - SAS how groupformat works -
i found on sas official website.
use groupformat option in statement ensure 1. formatted values used group observations when format statement , statement used in data step 2. first.variable , last.variable assigned formatted values of variable
and example uses illustrate usage of groupformat
proc format; value range low -55 = 'under 55' 55-60 = '55 60' 60-65 = '60 65' 65-70 = '65 70' other = 'over 70'; run; proc sort data=class out=sorted_class; height; run; data _null_; format height range.; set sorted_class; height groupformat; if first.height put 'shortest in ' height 'measures ' height:best12.; run;
but don't understand how example shows groupformat
"ensures" formatted values used group observations when format statement , statement used in data step
.
look @ results , without groupformat
statement:
4805 4806 data _null_; 4807 format height range.; 4808 set sorted_class; 4809 height groupformat; 4810 if first.height 4811 put 'shortest in ' height 'measures ' height:best12.; 4812 run; shortest in under 55 measures 51.3 shortest in 55 60 measures 56.3 shortest in 60 65 measures 62.5 shortest in 65 70 measures 65.3 shortest in on 70 measures 72 note: there 19 observations read data set work.sorted_class. note: data statement used (total process time): real time 0.05 seconds cpu time 0.01 seconds 4813 4814 data _null_; 4815 format height range.; 4816 set sorted_class; 4817 height ; 4818 if first.height 4819 put 'shortest in ' height 'measures ' height:best12.; 4820 run; shortest in under 55 measures 51.3 shortest in 55 60 measures 56.3 shortest in 55 60 measures 56.5 shortest in 55 60 measures 57.3 shortest in 55 60 measures 57.5 shortest in 55 60 measures 59 shortest in 55 60 measures 59.8 shortest in 60 65 measures 62.5 shortest in 60 65 measures 62.8 shortest in 60 65 measures 63.5 shortest in 60 65 measures 64.3 shortest in 60 65 measures 64.8 shortest in 65 70 measures 65.3 shortest in 65 70 measures 66.5 shortest in 65 70 measures 67 shortest in 65 70 measures 69 shortest in on 70 measures 72 note: there 19 observations read data set work.sorted_class. note: data statement used (total process time): real time 0.01 seconds cpu time 0.01 seconds
from there obvious groupformat
makes groups based on formatted value. without it, using raw value in height.
Comments
Post a Comment