Show the values of an arithmetic operation

Reply
Frequent Contributor
Posts: 75

Show the values of an arithmetic operation

I am new to SAS.

 

I would like to view the values of calculation using the variables in my dataset.

 

For Eg.

 

datalines;

 

X Y

1 2

5 6

.

.

 

 

I want to view the values of X/Y. What is the easiest to do it in SAS?

 

Thanks!

 

Frequent Contributor
Posts: 91

Re: Show the values of an arithmetic operation

Input your variables into a SAS table with a data statement and an input statement;

 

To show the table use proc print;   with a run statement after it.

 

data one;
input x y;
cards;
1 2
5 6
;
proc print; run;

Super Contributor
Posts: 290

Re: Show the values of an arithmetic operation

Do you want this?

data one; 
input x y;
z = x / y;
cards;
1 2
5 6
;
proc print; run;
SAS Employee
Posts: 12

Re: Show the values of an arithmetic operation

You can also display the values in the middle of a datastep

 

data one; 
input x y;
z = x / y;
put x= y= z=; * label each with the name;
put x y z; * just the values ;
put _all_; * list all variables with names, including system variables;
cards;
1 2
5 6
;
proc print; run;
Ask a Question
Discussion stats
  • 3 replies
  • 6512 views
  • 0 likes
  • 4 in conversation