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,

 

 

 

 

 

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