Help using Base SAS procedures

Format like COMMAw.d except for spaces

Reply
Frequent Contributor
Posts: 80

Format like COMMAw.d except for spaces

I have a need to output numeric data in a format like COMMAw.d except with spaces instead of commas:

123456789.123456789

outputs as

123 456 789.123 456 789

Is there a built in SAS format for this? I can make it by creating a character variable using put(, commaw.d) and then using translate to change all the commas to spaces, but it would be nice to have a format already. Thanks!
Respected Advisor
Posts: 4,173

Re: Format like COMMAw.d except for spaces

proc format;
  picture pCommaN
    low -< 0 = '00 000 009.900000' (prefix='-')
    0 - high = '00 000 009.900000'
  ;
run;

options ls=120;
data _null_;
  do a= -999912.123456 to 99999999.999999 by 999912.123456 ;
    put @1 'comma15.6: ' a comma15.6 @30 'comma24.6: ' a comma17.6 @61 'pCommaN.: ' a pCommaN.;
  end;
run;


HTH
Patrick
Frequent Contributor
Posts: 80

Re: Format like COMMAw.d except for spaces

Thanks!
Ask a Question
Discussion stats
  • 2 replies
  • 152 views
  • 1 like
  • 2 in conversation