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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 917 views
  • 0 likes
  • 3 in conversation