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

I tried searching for an answer on this topic but couldn't find a definitive answer.  Shouldn't the following code generate an error message?   The groupings overlap.   How would SAS decide where to put a value of "2" based on these groupings?

 

 

26 proc format;

27

27 ! value test

28 1-2='1-2'

29 2-3='2-3'

30 ;

NOTE: Format TEST has been output.

31 run;

NOTE: PROCEDURE FORMAT used (Total process time):

real time 0.05 seconds

cpu time 0.03 seconds

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

No it won't generate an error and it won't assign multiples, it uses the first instance or assume that's it's included. 

 

You can control the boundaries using < to explicitly include or exclude.

 

http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#n03qskwoints2an1ispy5...

 

proc format;
value test
1-<2 = '1-2'
2-3 = '2-3';
run;

data sample;
do i=1 to 4;
format i test.;
output;
end;
run;

View solution in original post

1 REPLY 1
Reeza
Super User

No it won't generate an error and it won't assign multiples, it uses the first instance or assume that's it's included. 

 

You can control the boundaries using < to explicitly include or exclude.

 

http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#n03qskwoints2an1ispy5...

 

proc format;
value test
1-<2 = '1-2'
2-3 = '2-3';
run;

data sample;
do i=1 to 4;
format i test.;
output;
end;
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!

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.

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
  • 1 reply
  • 1011 views
  • 0 likes
  • 2 in conversation