开发者

Apply format to null string

开发者 https://www.devze.com 2023-03-11 09:06 出处:网络
I\'d like to apply a label to nulls in a character variable. I can do this quite fine with numeric variables, but am unsuccessful with character vars. I\'d like to apply the label \'Both Groups\' to

I'd like to apply a label to nulls in a character variable.

I can do this quite fine with numeric variables, but am unsuccessful with character vars. I'd like to apply the label 'Both Groups' to the nul开发者_开发技巧l Group value (as created by the class option in proc means).

data group1;                      
   input group $1. freq;  
   datalines;
A 5
B 8
  13
;
proc format;
    value $ grpfmt  'A' = 'Group A'
                    'B' = 'Group B'
                    ''  = 'Both Groups'
                    ;
run;
proc sql;
    create table group2 as
        select group format = $grpfmt.,freq
            from group1;
quit;

Many thanks for any help.


Add space to the value of Both Groups, like

' ' = 'Both Groups'

Another way is to use the other option in the proc format.

other = 'Both Groups'


Just a wild guess...

did you try NULL = 'Both Groups' ?

0

精彩评论

暂无评论...
验证码 换一张
取 消