BookmarkSubscribeRSS Feed
VX_Xc
Calcite | Level 5

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 -<).

10 REPLIES 10
VX_Xc
Calcite | Level 5

What options do I have to make it work?

art297
Opal | Level 21

My initial guess is that it is either a bug or the documentation isn't correct.  According to the documentation it should work.

VX_Xc
Calcite | Level 5

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....

FriedEgg
SAS Employee

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.

Tom
Super User Tom
Super User

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).

art297
Opal | Level 21

I can.  Any values EXCEPT the extreme outliers.

VX_Xc
Calcite | Level 5

My reason is simple, "I don't like minimum and maximum of a variable. "

Tom
Super User Tom
Super User

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.

VX_Xc
Calcite | Level 5

     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.

art297
Opal | Level 21

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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 10 replies
  • 1330 views
  • 3 likes
  • 4 in conversation