BookmarkSubscribeRSS Feed
USHAKS
Fluorite | Level 6

compute ChangeN;
  _c4_ = (_c3_ - _c2_);
   endcomp;

 

when _C3_ is 2

and column _C2_  0

I want to see -2

but I am seeing in _c4_  0

 how to solve it.

2 REPLIES 2
PaigeMiller
Diamond | Level 26

@USHAKS wrote:

compute ChangeN;
  _c4_ = (_c3_ - _c2_);
   endcomp;

 

when _C3_ is 2

and column _C2_  0

I want to see -2

but I am seeing in _c4_  0

 how to solve it.


How about

_c4_ = _c2_-_c3_;

--
Paige Miller
USHAKS
Fluorite | Level 6

compute ChangeN;
  _c4_ = (_c3_ - _c2_);
   endcomp;

 

C3 is 2020 sales

c2 is 2019 sales

 

when it is c3 is 13

and c2 is 15 I get -2 

 

Assume C3 is 2020 sales and it is 0

C2 2019 sales 2

I do not get -2

 

thanks,

 

 

 

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 727 views
  • 0 likes
  • 2 in conversation