BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MikeZdeb
Rhodochrosite | Level 12

Hi.  It's good to know the variable type before using functions.  But if you don't care, you could use a CAT function with that INPUT function and SAS would give the same result whether the variable is CHAR or NUM ...

 

data _null_;
format num char 10.2;
retain x '12345' y 12345;
char = input(cat(x),5.);
num = input(cat(y),5.);
put x= char= / y= num=;
run;

 

the LOG .(no "nasty" messages) ...

 

191 data _null_;
192 format num char 10.2;
193 retain x '12345' y 12345;
194 char = input(cat(x),5.);
195 num = input(cat(y),5.);
196 put x= char= / y= num=;
197 run;

x=12345 char=12345.00
y=12345 num=12345.00

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 15 replies
  • 5720 views
  • 6 likes
  • 5 in conversation