BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tianerhu
Pyrite | Level 9

tianerhu_0-1616081346110.png

please give me the explain, Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

Since YEARS_SERVICE = 1 ("the employee has been with the company one year")

then AMOUNT=0.

Calculating AMOUNT_PER_YEAR involves division by AMOUNT.

Division by zero yields missing value (answer D) 

View solution in original post

4 REPLIES 4
Shmuel
Garnet | Level 18

Since YEARS_SERVICE = 1 ("the employee has been with the company one year")

then AMOUNT=0.

Calculating AMOUNT_PER_YEAR involves division by AMOUNT.

Division by zero yields missing value (answer D) 

tianerhu
Pyrite | Level 9

Thank you .

ballardw
Super User

Type code that does something similar using the values in the question.

Look at the log.

 

3    data example;
4       x=0;
5       y=5;
6       z= y/x;
7    run;

NOTE: Division by zero detected at line 6 column 8.
x=0 y=5 z=. _ERROR_=1 _N_=1
NOTE: Mathematical operations could not be performed at the following places. The results of the
      operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1 at 6:8
NOTE: The data set WORK.EXAMPLE has 1 observations and 3 variables.

X here is substituted for "amount", Y is "years_service".

 

tianerhu
Pyrite | Level 9

Thank you for your help.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 4 replies
  • 1156 views
  • 0 likes
  • 3 in conversation