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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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