Greetings. I'm using PC SAS to connect to the mainframe and reading a file. All is well, with the exception of one field in the dataset. The mainframe SAS job shows looks like below...
CD-REV-SRC 138 2 A
CD-CYCLE 154 2 B
CD-TOWN 156 4 A
So, I know I need to use @138 CD_REV_SRC $2. for the fist and third variables, but I cannot figure out what I need to use as the format for the second variable with the "B". Any ideas? If I use $2. I get some strange looking characters. If I use simply 2., I get missing values. The below is what I'm trying, and all variables come back okay other than the "B". Thank you.
data work.ontime;
INFILE ezt;
input
@1 ID_BA PD6.
@7 CD_BUS $4.
@16 DT_BILL $10.
@48 AT_SVC_UNIT_BILLED PD6.2
@100 CD_RATE $3.
@138 CD_REV_SRC $2.
@154 CD_CYCLE $2. <<<--- this one is the problem
@201 FL_MORE_REV_REC $1.;
run;
Greg
Perhaps B stands for Binary? Did you try IB or PIB informats?
Do you have any other reports or listings that you can look at to confirm that you read the values properly?
If those formats do not work then read it in as a string using $CHAR and print it using $HEX and post some example values.
Perhaps B stands for Binary? Did you try IB or PIB informats?
Do you have any other reports or listings that you can look at to confirm that you read the values properly?
If those formats do not work then read it in as a string using $CHAR and print it using $HEX and post some example values.
Thank you so much Tom. IB worked like a charm. It does make sense that it is binary since the field only contains values between 1 and 21.
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 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.