BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Mirisage
Obsidian | Level 7

Hi Forum,

I was reviewing a code written by another coder where I found a statement highlighted by blue colour which looks strange (at least for me) but SAS does not complains.

data tt;

set t;

……..

…….

Id_No=input(ID,12.);

…………………

……………..

run;

“ID” is a numeric variable.

After I have run the code, the new variable “Id_No” is created which is also a numeric variable.

No complains in the log.

Q:

What I have learned from the SAS class about explicit conversion is this.

Numeric to character conversion =put(Nvar, numeric format)

Character to numeric conversion = input(Cvar, numeric informat)

So, how could numeric to numeric happens like above?

Your help is appreciated.

Miris

1 ACCEPTED SOLUTION

Accepted Solutions
Quentin
Super User

Hi,

Are you sure there are no complaints in the log?

Below step is like yours.  As you say, the INPUT() function expects a character argument.  SAS converts the numeric ID value to a character value (implicit coversion causing the NOTE: ), and then reads that character value.

29   data a;
30     id=1;
31     id_no=input(id,12.);
32   run;

NOTE: Numeric values have been converted to character values at the places given by:
      (Line):(Column).
      31:15
NOTE: The data set WORK.A has 1 observations and 2 variables
The Boston Area SAS Users Group is hosting free webinars!
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.

View solution in original post

6 REPLIES 6
Quentin
Super User

Hi,

Are you sure there are no complaints in the log?

Below step is like yours.  As you say, the INPUT() function expects a character argument.  SAS converts the numeric ID value to a character value (implicit coversion causing the NOTE: ), and then reads that character value.

29   data a;
30     id=1;
31     id_no=input(id,12.);
32   run;

NOTE: Numeric values have been converted to character values at the places given by:
      (Line):(Column).
      31:15
NOTE: The data set WORK.A has 1 observations and 2 variables
The Boston Area SAS Users Group is hosting free webinars!
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
CTorres
Quartz | Level 8

Are you sure ID is a numeric variable?

Acording to the documentation the Input Function expects a character argument. See SAS(R) 9.3 Functions and CALL Routines: Reference

data_null__
Jade | Level 19

When I do it it does complain.  So you are not telling the whole story.

18         data _null_;
19            id = 1;
20            Id_No=input(ID,12.);
21            run;

NOTE:
Numeric values have been converted to character values at the places given by: (Line):(Column).
     
20:16  
PGStats
Opal | Level 21

... Unless you have used OPTIONS NONOTES;

PG

PG
cwcaulkins
Fluorite | Level 6

I never would have found that "little" option on my own - thanks, PG!

data_null__
Jade | Level 19

It's handy when you want to render the LOG useless.  Or if you're programming for job security.

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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
  • 6 replies
  • 1931 views
  • 4 likes
  • 6 in conversation