1

I need to create SAS informat that will change all case versions of 'Male' and 'Female' to digits.

I found in the documentation that there is UPCASE options that does the job. "converts all raw data values to uppercase before they are compared to the possible ranges. If you use UPCASE, then make sure the values or ranges you specify are in uppercase"

Unfortunately after adding the UPCASE option none of the input values is read properly. The SAS version id 9.2. My code is below.

options fmtsearch=(WORK);
proc format lib=WORK;
invalue gender UPCASE
MALE = 1
FEMALE = 2
;run;

data _null_;
    q='MALE';
    x=input(q,gender.);
    put q=;
    put x=;
run;

The log is:

NOTE: Invalid argument to function INPUT at line 186 column 7.
q=MALE
x=.
q=MALE x=. _ERROR_=1 _N_=1

What is the proper usage of this option?

pnuts
  • 58,317
  • 11
  • 87
  • 139
John Overiron
  • 517
  • 1
  • 5
  • 20
  • In your format put Male/Female in quotations. – Reeza Sep 28 '15 at 15:51
  • We do not have to use them here (online doc:If you omit the single or double quotation marks around character-string, then the INVALUE statement assumes that the quotation marks are there). This does not solve the issue. – John Overiron Sep 28 '15 at 16:02

1 Answers1

1

Very simple, just put UPCASE inside brackets...

Longfish
  • 7,582
  • 13
  • 19
  • Thanks @Keith. This is first time i see SAS letting in and ignoring free text. The code work without any notice: `proc format lib=WORK; invalue sex SAS IS VERY FLEXIBLE HERE MALE = 1 FEMALE = 2 ;run;` – John Overiron Sep 28 '15 at 17:01