BookmarkSubscribeRSS Feed
Mabitronics
Calcite | Level 5
The following produces wrong results;

data ex_atos_tg261ha;
attrib rvqun length=8 bzgzqrv length=$6;
infile cards dlm=";" truncover;
input rvqun : commax8.4 bzgzqrv;
cards4;
0,5;01XXXX
0,5;01XXXX
32,5;
30;
28;
26,5;
32,5;
0,5;01XXXX
;;;;
run;

Result:

Obs rvqun bzgzqrv

1 0.5000 01XXXX
2 0.5000 01XXXX
3 32.5000
4 0.0030
5 0.0028
6 26.5000
7 32.5000
8 0.5000 01XXXX

As you can see, obs 4 and 5 should be 30 and 28, respectively. I don't seem to find a proper informat. Can anyone help?

Cheers,

Mabitron
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
The ".4" in your informat tells SAS to insert a decimal point if it does not find one in the number it is reading. You can have the numbers treated correctly by removing the .4 from your informat. In fact, since you've given a length and a delimiter, you really don't need the 8 either. So these should both work:
[pre]
input rvqun : commax8. bzgzqrv;

input rvqun : commax. bzgzqrv;
[/pre]

cynthia
Mabitronics
Calcite | Level 5
Great, thanks!!

MB

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 709 views
  • 0 likes
  • 2 in conversation