BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vasireddyajay
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Sam_SAS
SAS Employee

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.

View solution in original post

4 REPLIES 4
Sam_SAS
SAS Employee

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

vasireddyajay
Fluorite | Level 6

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

Sam_SAS
SAS Employee

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.

vasireddyajay
Fluorite | Level 6

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1547 views
  • 1 like
  • 2 in conversation