PROC FORMAT;
VALUE format5a 7 -< HIGH = '7 to max exclusive';
VALUE format6a LOW <- HIGH = 'All the range excluding min' ;
run;
Above sends error.
I can do it without the excluding symbol (i.e. - rather than -<).
What options do I have to make it work?
My initial guess is that it is either a bug or the documentation isn't correct. According to the documentation it should work.
166 PROC FORMAT;
167 VALUE format5a 7 -< HIGH = '7 to max exclusive';
----
22
76
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,
a datetime constant, a missing value.
ERROR 76-322: Syntax error, statement will be ignored.
NOTE: The previous statement has been deleted.
168 VALUE format6a LOW <- HIGH = 'All the range' ;
-
22
200
ERROR 22-322: Syntax error, expecting one of the following: ',', -, =.
ERROR 200-322: The symbol is not recognized and will be ignored.
NOTE: The previous statement has been deleted.
169 run;
NOTE: PROCEDURE FORMAT used (Total process time):
real time 15.56 seconds
cpu time 1.56 seconds
NOTE: The SAS System stopped processing this step because of errors.
This is what I got....
The issue is not the condition it is the usage of high and low with this excluding symbol. This exception is not in the documentation.
Not sure what you are trying to get SAS to do.
If you want the full range use LOW - HIGH.
I cannot see any meaning trying to exclude LOW or HIGH (whatever actual number they might be).
I can. Any values EXCEPT the extreme outliers.
My reason is simple, "I don't like minimum and maximum of a variable. "
You will need to use something other than (or in addition to) a format to eliminate the minimum and maximum observed values. HIGH and LOW in the VALUE statement just mean the largest and smallest floating point number possible on the machine's hardware.
Ok, so it's not a defined (closed form) value?
Intuitively for me(person without computer related degree) if HIGH is defined to be a general term that maps itself onto the maximum value of given numeric variable then I think of it as just an object that is assigned with the maximum of given variable.
Thanks for the info.
While the documentation doesn't appear to define them, low and high might be the lowest and highest values possible on one's system and, if so, it wouldn't have much applicability to exclude them.
However, if you wanted to create a format that excluded the highest are lowest values in your data, you could always created macro variables that set the values before defining the desired formats. E.g.:
data have;
informat dates date9.;
format dates date9.;
input dates;
cards;
01dec2011
02dec2011
03dec2011
04dec2011
05dec2011
06dec2011
07dec2011
08dec2011
;
proc sql noprint;
select distinct min(dates),max(dates)
into :low,:high
from have
;
quit;
PROC FORMAT;
VALUE format5a '05dec2011'd-< &HIGH = "12/5 to max exclusive";
VALUE format6a &LOW<-'08dec2011'd = "All the range excluding min";
run;
data test;
set have;
format dates1 format5a.;
format dates2 format6a.;
dates1=dates;
dates2=dates;
run;
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 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.