BookmarkSubscribeRSS Feed
Filipvdr
Pyrite | Level 9

;;;-0.0138054214235035;-0.0774003621264634;-0.140738451940042;-0.202179585345623;-0.261822556355244;-0.322223016158721;-0.382933059864945;-0.443359874483071;-0.502726219354504;-0.561598550197106...

i got a seperated list of numbers (formatted as character 10000 field)

i use the folowwing code: but my numbers get cut to

-0.013805421

data edc_measures;

set edc(keep=curve_id V I);

array V_{500};

j = 1;

    do while (scan(V,j,';') NE '');

V_{j} = input(scan(V,j,';'),best32.);

j = j +1;

end;

run;

the format in the table says BEST12.??

Any help to get the numbers in full?

4 REPLIES 4
art297
Opal | Level 21

You're going to run into a numeric precision limitation anyway, but you are never setting the format.  Try:

data edc_measures;

  input v $32.;

  format VNum best32.;

  VNum= input(V,best32.);

  cards;

-0.0138054214235035

-0.0774003621264634

-0.140738451940042

-0.202179585345623

-0.261822556355244

-0.322223016158721

-0.382933059864945

-0.443359874483071

-0.502726219354504

-0.561598550197106

;

run;

FriedEgg
SAS Employee

What are you planning to do with the numbers, you may want to consider storing as character, depending on your intention.

FloydNevseta
Pyrite | Level 9

The underlying value is not getting "cut" or truncated to 12 characters. SAS is only displaying 12 characters with the best12. format. For the list of numbers you have shown, add a format of, say, 23.18 to your data step for your V_ variables (format V_: 23.18;) and you will see that SAS is storing more than you had thought. However, art297 does point out that you will have precision issues.

DouglasMartin
Calcite | Level 5

He might be OK regarding precision issues depending on the hardware he is running on. I count 15 significant digits in all his numbers. According to http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#numvar.htm with 8 byte numerics Windows does support 15 significant digits.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 858 views
  • 0 likes
  • 5 in conversation