Help using Base SAS procedures

Strange Behavior of COMMAXw.d informat

Reply
New Contributor
Posts: 2

Strange Behavior of COMMAXw.d informat

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
SAS Super FREQ
Posts: 8,776

Re: Strange Behavior of COMMAXw.d informat

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
New Contributor
Posts: 2

Re: Strange Behavior of COMMAXw.d informat

Great, thanks!!

MB
Ask a Question
Discussion stats
  • 2 replies
  • 94 views
  • 0 likes
  • 2 in conversation