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. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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