BookmarkSubscribeRSS Feed
christinawkhau
Calcite | Level 5

What does double brackets mean??

 

I see this in my sas program that I dont recognise:

 

sme=((Customer_type='C')):

 

how could the above be interpreted?

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

You should interpret this as a boolean expression, meaning that it will return either 0 (FALSE) or 1 (TRUE). Programmers tend to use brackets to indicate a boolean expression, though usually, they are not necessary. In this case, the double brackets certainly are not necessary . 

 

See the small example below. 

 

data _null_;
   a = (1 = 2);
   b = (2 = 2);
   
   put (a b)(=);
run;
ballardw
Super User

@christinawkhau wrote:

What does double brackets mean??

 

I see this in my sas program that I dont recognise:

 

sme=((Customer_type='C')):

 

how could the above be interpreted?


Often when I see code with duplicated () I suspect either code editing, where some other element was present in the code such as below an removed OR thinking that such an addition was considered but not implemented.

sme=((Customer_type='C') and (othervar = something)):

The intent would be to force a dichotomous 1/0 valued result for the comparison.

 

If you haven't see that type of coding it is sometimes used in place of

If Customer_type='C' then sme= 1;
else sme=0 ;

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 697 views
  • 2 likes
  • 3 in conversation