Help using Base SAS procedures

How to Display Decimal values and Integer values in the same column.

Reply
Contributor
Posts: 67

How to Display Decimal values and Integer values in the same column.

Hi Member,

How to display decimal values and integer values in the same column? For example, I want my column looks like:

  Column

     1.62

     2

     3

     1.59

      .

      .

      .

Now the result I got is:

  Column

     1.20

     2.00

     3.00

     1.17

Here is the program:

data test;

   input A B;

   C = round(A/B, .01);

   cards;

   6  5

   8  4

   9  3

   7  6

   ;

run;

proc print data = test; run;

Is there a way that I don't need to show decimals when the number is integer (like 2), and keep the decimals when it is not integer (like 1.20).

Thank you for your help.

Super Contributor
Posts: 307

Re: How to Display Decimal values and Integer values in the same column.

Contributor
Posts: 67

Re: How to Display Decimal values and Integer values in the same column.

Hi Fugue,

I got what I want. Thank you!

Ask a Question
Discussion stats
  • 2 replies
  • 203 views
  • 3 likes
  • 2 in conversation