Hello Experts,
I have a numeric value with comma
-0,165530135449
I would like to have this value with a point: -0.165530135449
Could you advise me the format please, the best32. doesn't work.
Thank you very much!
Try this:
data _null_;
x = -0.165530135449;
put x= bestx32.15;
put x= best32.15;
put x= comma32.15;
put x= commax32.15;
run;
data _null_;
input x commax32.;
put x= bestx32.15;
put x= best32.15;
put x= comma32.15;
put x= commax32.15;
cards;
-0,165530135449
;
run;
Try this:
data _null_;
x = -0.165530135449;
put x= bestx32.15;
put x= best32.15;
put x= comma32.15;
put x= commax32.15;
run;
data _null_;
input x commax32.;
put x= bestx32.15;
put x= best32.15;
put x= comma32.15;
put x= commax32.15;
cards;
-0,165530135449
;
run;
data have;
x = -0.165530135449;
format x datetime.; /* wrong format */
run;
proc print data = have;
run;
proc sql;
alter table have
modify x format=commax32.15 /* new format */
;
quit;
proc print data = have;
run;
B-)
what do you mean by "it"?
@SASdevAnneMarie wrote:
It replaces the comma by point?
Formats change the appearance of the number for the benefit of humans looking at the number; the underlying numeric value is unchanged. I don't think the word "replaces" applies here.
@SASdevAnneMarie wrote:
Hello Experts,
I have a numeric value with comma
-0,165530135449
I would like to have this value with a point: -0.165530135449
Could you advise me the format please, the best32. doesn't work.
Thank you very much!
If you have a numeric variable and it is display the decimal marker as a comma instead of a period then you have either attached a format that asks to display that way (BESTX, COMMAX, NLNUM) or the SAS session is running with language settings that tells SAS you are in a part of the world where comma is the normal character to use.
Check what format is attached to the variable. For example by running PROC CONTENTS on the dataset.
You can use the NLNUMI format to force SAS to display the values with period for the decimal place and comma as the thousands separators no matter what the language settings are..
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: