BookmarkSubscribeRSS Feed
ginak
Quartz | Level 8

NUM_CBTWSN =input(NUM_CBTWS, 5.);

If NUM_CBTWSN is my new variable, what does the command "input(NUM_CBTWS, 5.)" mean? CBTWSN is the new variable and NUM_CBTWS is the old variable.

Thanks,

Gina Smiley Happy

9 REPLIES 9
MichelleHomes
Meteorite | Level 14

Hi Gina,

Your NUM_CBTWS is a character type variable and you are using the input function with a SAS numeric informat of 5. to convert it to a character type and store it in the new character variable NUM_CBTWSN.

You can learn more about the input function as per the documentation at, http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p19en16vskd... and see Example 1.

Cheers,

Michelle

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com
Patrick
Opal | Level 21

I assume Michelle's fingers didn't type what she actually wanted to say.

"...with a SAS numeric informat of 5. to convert it to a character type and store it in the new character variable NUM_CBTWSN."

Should be:

"...with a SAS numeric informat of 5. to convert it to a number and store it in the new numeric variable NUM_CBTWSN."

MichelleHomes
Meteorite | Level 14

Oops... Thanks for the correction Patrick. Yes brain and fingers mis-match. 🙂

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com
ginak
Quartz | Level 8

thank you Smiley Happy

Vish33
Lapis Lazuli | Level 10

Hi,

NUM_CBTWSN : it is the new variable created based on the existing variable NUM_CBTWS

input function is to convert a character variable type to numeric variable type.

so  your new variable NUM_CBTWSN is a numeric variable which is having a length of 5 bytes(default 8 bytes)

ginak
Quartz | Level 8

thank you Smiley Happy

ginak
Quartz | Level 8

thank you Smiley Happy

art297
Opal | Level 21

I didn't see anyone point out an alternative that could also be true.  If NUM_CBTWS is a numeric variable, then the function won't return an error, but will return a missing value.


manojinpec
Obsidian | Level 7

The function changes the character  variable to numeric.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 9 replies
  • 1181 views
  • 10 likes
  • 6 in conversation