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;
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.
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.