12-14-2016 04:33 PM - last edited on 12-14-2016 04:44 PM by Reeza
Is there any method,option or statement to ignore case sensitivity for variables.
if I compare using Proc Compare ,datasetA and datasetB, results showing as diferences in two datasets.
How to make proc compare case insensitive?
thanks in advance.
12-14-2016 06:06 PM
12-15-2016 09:05 AM
PROC COMPARE compares raw values. If you want a case-insensitive comparison, you can use the UPCASE function or the $UPCASE format to transform character data. You can either do this directly in the DATA step, or you can create data VIEWS that contain the upcase version of character data. For example:
/* create second data set with lowercase names */ data class2; set sashelp.class; Name = lowcase(Name); run; /* create data views with upcase names */ data BaseData / view=BaseData; set sashelp.class; NewName = upcase(Name); run; data CompareData / view=CompareData; set class2; NewName = upcase(Name); run; /* compare the upcase values */ proc compare base=BaseData compare=CompareData; var NewName; run;
12-15-2016 03:49 PM
12-15-2016 04:07 PM
I agree that this could be useful for analysts who processes English strings (in general, use the Roman alphabet). I seem to recall this request on the SAS Software ballot in the early 2000s. However, that was about the same time that SAS was going global. Many SAS customers process text in Japanese, Chinese, Korean, and other languages for which "uppercase" does not make sense. I'm not making excuses, and I don't have any knowldege about why there isn't a case-insensitive option, but I mention non-Latin languages as a possible reason why this feature was never added.