BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
gsnidow
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

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.

gsnidow
Obsidian | Level 7

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. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1431 views
  • 0 likes
  • 2 in conversation