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
Diamond | Level 26
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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 995 views
  • 0 likes
  • 2 in conversation