Desktop productivity for business analysts and programmers

Problems transforming character data to percentage

Accepted Solution Solved
Reply
Contributor
Posts: 58
Accepted Solution

Problems transforming character data to percentage

Hi, I have percentage data but in character format. I'm using this code to transform it:

data monic.fondorfdol;

set work.fondorfdol;

tir1=input(tir,percent5.5);

run;

But I don't get the exact number, for example, these are original values:

5.8077%

1.7514%

After the transformation, I get:

5.807

1.751

It's not necessary the percetange symbol, but I want to have all decimal numbers, is it possible?

Thanks!


Accepted Solutions
Solution
‎10-14-2014 12:23 PM
Esteemed Advisor
Posts: 7,296

Re: Problems transforming character data to percentage

data monic.fondorfdol;

  set work.fondorfdol;

  tir1=input(tir,percent.);

run;

View solution in original post


All Replies
Solution
‎10-14-2014 12:23 PM
Esteemed Advisor
Posts: 7,296

Re: Problems transforming character data to percentage

data monic.fondorfdol;

  set work.fondorfdol;

  tir1=input(tir,percent.);

run;

Contributor
Posts: 58

Re: Problems transforming character data to percentage

Thank you very much, I always thought that I have to specify the width of the value.

Esteemed Advisor
Posts: 7,296

Re: Problems transforming character data to percentage

The number after the period in an informat isn't the number of decimal places. According to the documentation: the number specifies an optional decimal scaling factor in the numeric informats. SAS divides the input data by 10 to the power of d.

☑ This topic is SOLVED.

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

Discussion stats
  • 3 replies
  • 222 views
  • 1 like
  • 2 in conversation