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

hello,

I am trying to convert the ASSEV variables values into numeric values . I created format for that and then used that format , but the numeric variable (AESEVN) values are missing. What wrong I am doing ,could u plz check .

Format  and note is below ;

/****************************************/

proc format;
invalue sev
"mild" = 1
"moderate" = 2
"severe" = 3;
run;

 

data test;
set ae;
aesevn = input(aesev,??sev.);
run;

 

note is showing into the log:

 

NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-15 aeterm=AE1 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=1
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-25 aeterm=AE1 aesev=Severe aeser= aediscon= aesevn=. _ERROR_=1 _N_=2
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-15 aeterm=AE2 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=3
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-25 aeterm=AE2 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=4
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-15 aeterm=AE3 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=5
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-25 aeterm=AE3 aesev=Mild aeser= aediscon=1 aesevn=. _ERROR_=1 _N_=6
 
 
Thanks 
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Spelling counts. "mild" is not "Mild" , which appears in your data.

Try this:

proc format;
invalue sev (upcase)
"MILD" = 1
"MODERATE" = 2
"SEVERE" = 3;
run;

The upcase option will turn the text into upper case before comparing the values in the informat list. So spellings in the source of "mild" "Mild" "mILD" "milD" and other possible typos all use "MILD" for assigning the numeric value.

If your data is clean, then use the proper spelling to begin with. I tend to use the UPCASE option on all my character to numeric informats just because I don't trust my sources (with good reason) to spell things consistently.

 

 


@u52766097 wrote:

hello,

I am trying to convert the ASSEV variables values into numeric values . I created format for that and then used that format , but the numeric variable (AESEVN) values are missing. What wrong I am doing ,could u plz check .

Format  and note is below ;

/****************************************/

proc format;
invalue sev
"mild" = 1
"moderate" = 2
"severe" = 3;
run;

 

data test;
set ae;
aesevn = input(aesev,??sev.);
run;

 

note is showing into the log:

 

NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-15 aeterm=AE1 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=1
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-25 aeterm=AE1 aesev=Severe aeser= aediscon= aesevn=. _ERROR_=1 _N_=2
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-15 aeterm=AE2 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=3
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-25 aeterm=AE2 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=4
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-15 aeterm=AE3 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=5
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-25 aeterm=AE3 aesev=Mild aeser= aediscon=1 aesevn=. _ERROR_=1 _N_=6
 
 
Thanks 

 

View solution in original post

2 REPLIES 2
ballardw
Super User

Spelling counts. "mild" is not "Mild" , which appears in your data.

Try this:

proc format;
invalue sev (upcase)
"MILD" = 1
"MODERATE" = 2
"SEVERE" = 3;
run;

The upcase option will turn the text into upper case before comparing the values in the informat list. So spellings in the source of "mild" "Mild" "mILD" "milD" and other possible typos all use "MILD" for assigning the numeric value.

If your data is clean, then use the proper spelling to begin with. I tend to use the UPCASE option on all my character to numeric informats just because I don't trust my sources (with good reason) to spell things consistently.

 

 


@u52766097 wrote:

hello,

I am trying to convert the ASSEV variables values into numeric values . I created format for that and then used that format , but the numeric variable (AESEVN) values are missing. What wrong I am doing ,could u plz check .

Format  and note is below ;

/****************************************/

proc format;
invalue sev
"mild" = 1
"moderate" = 2
"severe" = 3;
run;

 

data test;
set ae;
aesevn = input(aesev,??sev.);
run;

 

note is showing into the log:

 

NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-15 aeterm=AE1 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=1
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-25 aeterm=AE1 aesev=Severe aeser= aediscon= aesevn=. _ERROR_=1 _N_=2
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-15 aeterm=AE2 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=3
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-25 aeterm=AE2 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=4
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-15 aeterm=AE3 aesev=Mild aeser= aediscon= aesevn=. _ERROR_=1 _N_=5
NOTE: Invalid argument to function INPUT at line 71 column 10.
usubjid=1001 aestdtc=2021-01-25 aeterm=AE3 aesev=Mild aeser= aediscon=1 aesevn=. _ERROR_=1 _N_=6
 
 
Thanks 

 

u52766097
Fluorite | Level 6
Thanks , it worked .



hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1290 views
  • 2 likes
  • 2 in conversation