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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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