Hi Team,
How I can convert a numeric value using put and input to comma.
var=100000;
new_var=100,000;
Thanks and regards,
JC
Is that a comma for the 1000/1 million etc separation? Then use the comma format:
new_var = put(var,comma8.);
If more digits are needed, increase the width value accordingly.
PUT will create a character variable. I suspect you want a numeric format
format variable comma.;
No , Actually I want to convert it to char value because I am concatenating with another variable..
I tried and variable needs to be in char format to concatenate with another variable.
So I need to convert it from:
var=100000 to new_var=100,000 -->> new_var in char format
When concatenating I recommend using CATT/CATX etc family of functions. They don't require a character variable.
r1=put(input("Range Start"n,15.),comma12.);
r2=put("Range End"n,comma15.);
Range=CATX('_',r1,r2);Yes I used that function and It worked, thanks for the comment
Is that a comma for the 1000/1 million etc separation? Then use the comma format:
new_var = put(var,comma8.);
If more digits are needed, increase the width value accordingly.
Thanks Kurt,
It worked 🙂
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.