BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I learned long ago that it is better to use 'eq' when making comparisons and to use the = sign when setting the value of a variable. As in

if x eq 0 then y = 1;

I have always done it this way, but I do not remember why. So today I was trying to fix a colleague's program which seemed logically correct on the surface, but the output was clearly wrong. Eventually I tried changing all his mathematical symbols to the letter equivilent (eq, gt, ....) and the program works correctly now. But I don't know how to explain WHY it should be this way (to a guy whose first language is not english but who makes his own electronic equipment for his guitar).
1 REPLY 1
LinusH
Tourmaline | Level 20
The eq operator can only be used in comparisons, in IF and WHERE for example. The = operator can be used both in comparisons and in assignments.

Some people think it's easier to read the code if using different operators in assignment and comparison statements, but technically, there is no difference.

/Linus
Data never sleeps

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
  • 12834 views
  • 1 like
  • 2 in conversation