Help using Base SAS procedures

What does this statement do?

Reply
Contributor
Posts: 67

What does this statement do?

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

Trusted Advisor
Posts: 1,253

What does this statement do?

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

Respected Advisor
Posts: 3,902

What does this statement do?

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."

Trusted Advisor
Posts: 1,253

What does this statement do?

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

Contributor
Posts: 67

What does this statement do?

thank you Smiley Happy

Frequent Contributor
Posts: 117

What does this statement do?

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)

Contributor
Posts: 67

What does this statement do?

thank you Smiley Happy

Contributor
Posts: 67

What does this statement do?

thank you Smiley Happy

PROC Star
Posts: 7,366

Re: What does this statement do?

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.


Frequent Contributor
Posts: 138

Re: What does this statement do?

The function changes the character  variable to numeric.

Ask a Question
Discussion stats
  • 9 replies
  • 280 views
  • 10 likes
  • 6 in conversation