Help using Base SAS procedures

How to display all negative values?

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 88
Accepted Solution

How to display all negative values?

I have a variable that i created by subtracting one variable from another. I want to be able to view all negative values along with my two original values.

 

How can I accomplish this?

 

I know this is so easy but I haven't been able to find it online.

 

I tried:

 

proc print data=test;
var variable1=-;
run;

 I tried other variations of this as well. 


Accepted Solutions
Solution
‎08-19-2016 08:26 AM
Super User
Posts: 10,500

Re: How to display all negative values?

Did you actually create a new variable? If not then some data code similar to:

 

data want;

    set have;

    newvar = var1-var2;

run;

 

Or are you saying you want to print just those with negative values for the variable?

Proc print;

   where variable1 < 0;

run;

View solution in original post


All Replies
Solution
‎08-19-2016 08:26 AM
Super User
Posts: 10,500

Re: How to display all negative values?

Did you actually create a new variable? If not then some data code similar to:

 

data want;

    set have;

    newvar = var1-var2;

run;

 

Or are you saying you want to print just those with negative values for the variable?

Proc print;

   where variable1 < 0;

run;

Frequent Contributor
Posts: 88

Re: How to display all negative values?

oh! so simple. duh! Thank youSmiley Happy

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 472 views
  • 4 likes
  • 2 in conversation