I want to convert a numeric variable (var1) to character (var2) and add "." in to the string like the following. How could I do it? I know how to convert the numeric to character use PUT, but I failed to put the "." into the converted string. Thank you for helping in advance!
Joy
ID var1 var2
111 745510 745.510
112 742100 742.100
113 745510 745.510
114 745510 745.510
@Xiaoyi wrote:
I want to convert a numeric variable (var1) to character (var2) and add "." in to the string like the following. How could I do it? I know how to convert the numeric to character use PUT, but I failed to put the "." into the converted string. Thank you for helping in advance!
Joy
ID var1 var2
111 745510 745.510
112 742100 742.100
113 745510 745.510
114 745510 745.510
It might help to show the code you attempted.
The values you show makes me think that a divide by 1000 should have been involved.
If you want to represent the number with your local conventions, you can use a National Language format such as NLNUM7.0. For example:
71 options LOCALE=German_Germany; 72 data _null_; 73 x=123456; 74 put x nlnum7.0; 75 run; 123.456
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 25. 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.