07-26-2017 06:08 AM - last edited on 07-26-2017 06:16 AM by KurtBremser
I have below data in a file and i want to read in a dataset
this is how file looks
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
07-26-2017 06:20 AM
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;
07-26-2017 06:55 AM
07-26-2017 07:14 AM
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.
07-26-2017 08:03 AM
"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;