## Scientific notation in VA

Solved
Occasional Contributor
Posts: 18

# Scientific notation in VA

Hi,

can you please tell me how to convert scientific character to numeric value in SAS VA.

quantity = "1.66666666666666E-06"

I tried to Parse text to numeric value.But, somehow I got wrong result.

Thanks.

Accepted Solutions
Solution
‎10-20-2015 02:24 AM
SAS Super FREQ
Posts: 322

## Re: Scientific notation in VA

Is it possible that some of your values have a greater degree of precision than the example value you provided?

The more decimals there are in front of the E, the wider your format (really an informat) width needs to be on the Parse operator.

All Replies
SAS Super FREQ
Posts: 322

## Re: Scientific notation in VA

Hello,

You are on the right track with the Parse operator, but the parameters are a little tricky.

What you will want to do is create a calculated item using the Parse operator, specifying the F format and a width that is wide enough to handle your values. For example, you need to specify at least width 20 to handle the value 1.66666666666666E-06.

You will also need to ensure that your output format (at the bottom of the New Calculated Item window) displays the values like you want. If you specify Numeric with width 20, the value is displayed as 1.66666666666666E-06 but it is processed appropriately as a numeric. If you specify Numeric with width 24, the value is displayed as 0.00000166666666666666 because the width is wide enough to display all the zeroes.

Does that help?

Thanks,

Sam

Occasional Contributor
Posts: 18

## Re: Scientific notation in VA

Hi Sam,

thank you for the reply. I am using 7.1 and I have a value zero instead of 0.00000166666666666666. As mentioned, I first parsed with F with width 20 and then applied Numeric width 24 in Measure. How ever, I have got the value zero.

Thanks.

Kind regards,

Ajaykumar

Solution
‎10-20-2015 02:24 AM
SAS Super FREQ
Posts: 322

## Re: Scientific notation in VA

Is it possible that some of your values have a greater degree of precision than the example value you provided?

The more decimals there are in front of the E, the wider your format (really an informat) width needs to be on the Parse operator.

Occasional Contributor
Posts: 18

## Re: Scientific notation in VA

Hi Sam,

indeed. The length was 21 instead of 20. And it worked like a magic when I gave the informat length to be 21.

Thank you very much.

Kind regards,

Ajay

🔒 This topic is solved and locked.