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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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