Syntax, assignment statement:
variable=expression;
Tip:The assignment statement is
one of the few SAS statements that do not begin with a keyword.
|
Toby
Witherspoon
to the variable Name: Name='Toby Witherspoon';
Operator
|
Action
|
Example
|
Priority
|
---|---|---|---|
-
|
negative prefix
|
negative=-x; |
1
|
**
|
exponentiation
|
raise=x**y; |
1
|
*
|
multiplication
|
mult=x*y; |
2
|
/
|
division
|
divide=x/y; |
2
|
+
|
addition
|
sum=x+y; |
3
|
-
|
subtraction
|
diff=x-y; |
3
|
Operator
|
Meaning
|
Example
|
---|---|---|
= or eq
|
equal to
|
name='Jones, C.' |
^= or ne
|
not equal to
|
temp ne 212 |
> or gt
|
greater than
|
income>20000 |
< or lt
|
less than
|
x=5000 x<8000 |
>= or ge
|
greater than or equal
to
|
x=5000 x>=2000 |
<= or le
|
less than or equal to
|
pulse le 85 |
Operator, symbol
|
Description
|
---|---|
AND or &
|
and, both. If both expressions
are true, then the compound expression is true.
|
OR or |
|
or, either. If either
expression is true, then the compound expression is true.
|
data work.stresstest;
set cert.tests;
TotalTime=(timemin*60)+timesec;
run;
proc print data=work.stresstest;
run;
data work.stresstest;
set cert.tests;
resthr=resthr+(resthr*.10);
run;
proc print data=work.stresstest;
run;
Syntax, date constant:
'ddmmmyy'd
'ddmmmyy'd
Tip:Be sure to enclose the date
in quotation marks.
|
Time='9:25't; DateTime='18jan2018:9:27:05'dt;
data work.stresstest;
set cert.tests;
TotalTime=(timemin*60)+timesec;
TestDate='01jan2015'd;
run;
proc print data=work.stresstest;
run;