proc format ;
invalue $sex 'F'='female' 'M'='male';
run;
data s ;
set sashelp.class ;
gender=put(sex,$sex.) ;
run;
it doesn't give data
is there any mistake please let me know
proc format ;
invalue age 11=100 12=200 13=300 14=400 15=500 16=600 ;
run;
data s ;
set sashelp.class ;
new_age=input(age,age.) ;
run;
when i run above program it gives values but it shows note like see below
proc format ;
invalue age 11=100 12=200 13=300 14=400 15=500 16=600 ;
run;
data s ;
set sashelp.class ;
new_age=input(age,age.) ;
run;
when i run above program it gives data but show not log window like see below photo
The input()function expects a string as its first argument, so SAS needs to convert the numeric age to character first.
To avoid the message, add a put() inside the input() to explicitly convert age.
@thanikondharish wrote:
proc format ;
invalue age 11=100 12=200 13=300 14=400 15=500 16=600 ;
run;data s ;
set sashelp.class ;
new_age=input(age,age.) ;
run;
when i run above program it gives values but it shows note like see below
If you ever read the documentation for the INPUT function you would know that the first parameter is expected to be character values.
Since you have used INPUT with a numeric variable AGE in the position where it expects character values then SAS tries to help by converting the numeric variable to character to do what you attempt. And then it places the note in the LOG to tell you that may have done something you did not expect with the implication that the result might not quite be what you expect.
Formats are for converting values to text and informats for converting text to values.
You use formats with PUT statement and PUT() function.
You use informats with INPUT statement and INPUT() function.
You need to either define a FORMAT instead of INFORMAT, or use the INPUT() instead of the PUT() function.
You have two responses to the question answering it, please go ahead and mark one as correct and close the topic - in fact all of your questions on here are still unanswered, please close them out.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.