Hello
I have below data in a file and i want to read in a dataset
this is how file looks
00000000134623C
00000000153746E
00000000000085G
00000000017120E
Atually I am trying to read this file on SAS eg tool.Actaully thiS program was running on mainframe and they were reading this like this @1 mark S370FZD15.2
I am trying to read it as @1 mark 15.2 but it gives me error
I want output to be
13642.33
15374.65
8.57
1712.05
Thanks!!
Using "base sas" as a subject line in the Base SAS Programming forum is, ahem, not very descriptive.
Therefore I changed your subject line.
When reading the documentation for the S370FZD informat, you'll notice a reference to the FZD informat, which does the same without converting from the mainframe's EBCDIC character set.
So do this:
data want;
input mark zd15.2;
cards;
00000000134623C
00000000153746E
00000000000085G
00000000017120E
;
run;
That looks like a problem when the file was copied from the mainframe. Be aware that mainframe codepages may have an influence here.
That's why I used to copy mainframe files in binary mode and use the s370 informats on UNIX.
Inspect the hex codes of the offending characters on the MF and after transfer on the new platform. Once you find a rule, read the data first as character, then translate the bad characters, and finallly use FZD. in an input statement.
Unless you can fix the transfer problem, of course.
PS
"Workaround" code could look like this:
data want;
input markstr $15.;
markstr = translate(markstr,'F','e6'x);
mark = input(markstr,zd15.2);
cards;
00000000134623C
00000000153746E
00000000000085G
00000000017120E
00000000000529æ
;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.