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

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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