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 ;

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 2 replies
  • 405 views
  • 2 likes
  • 3 in conversation