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

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 5850 views
  • 6 likes
  • 5 in conversation