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

(1)  I have a column of data that looks has either a positive amount or a negative number.  The data is suppose to be formatted 12.2
For example: 
FRED        000002300086
BARNEY   -99999999999

Fred's amount     =         23,000.86   and
Barney's amount =  -99999999.99

The Variable Name that I am having trouble with is:  TotalRewardCash shown below.

(2) A second question I have is the Variable PeriodId is yyyymmdd and I would like to read it in as a date, but couldn't find an ebcdic format that would work properly.

DATA CCARD_RAW_DATA;

   INFILE COMMCARD;

   INPUT

@1 ReferenceNumber         $EBCDIC12.

@13 CustomerID                 $EBCDIC12.

@25 BankId                         $EBCDIC12.

@37 PeriodId                       $EBCDIC8.   

@135 TotalRewardCash      S370FZDU12.2 ;

RUN;

I have tried many informats but this one gets me the closest.  It brings in the numbers but will not bring in the leading negative sign.

I have tried   S370FZDL12.2 but then I get nothing.

Does anyone have any suggestions?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Linda_V
Obsidian | Level 7

Update...

I got it to work...   The INFORMAT can be 12.2 but then I need to FORMAT it bigger....  14.2 to fit the decimal sign and the leading minus sign... YAY!!!   

View solution in original post

3 REPLIES 3
jakarman
Barite | Level 11

When you are running this code in a mainframe you do not the $EBCDIC coding the $ coding will do as Ebcdic is default in z/OS.
When you have downloaded the file binary, beware of record formats. Sometimes you get trapped by cr/lf characters as part of numeric values.

There are several dedicated numeric formats at z/OS.

- floating often not used with Cobol.

- packed (with signs) the two digits are getting compressed by their hexadecimal representation
- Zoned  (with signs) the digits are not compressed but the last digit is with the sign.
- character based. Similar to zoned but not having signs. It is more a constraint on some values on the used chars. 

You have used the unsigned zoned type. No wonder you no signs

SAS(R) 9.4 Formats and Informats: Reference  S370FZDw.d Informat is most common. Watch the notes on the used Cobol Picture. When you know that one you are sure wich format to be used.

---->-- ja karman --<-----
Linda_V
Obsidian | Level 7

I am not using Mainframe SAS to read the file.   I use Enterprise Guide interface and read the Mainframe file via FTP statement.  That is why I need to use the EBCDIC informats to read my data in.  Otherwise I get gibberish.

I have tried all of the file formats listed and none of them get me the desired results.

I will review the website to see if I missed any.  Thanks anyway..

Linda_V
Obsidian | Level 7

Update...

I got it to work...   The INFORMAT can be 12.2 but then I need to FORMAT it bigger....  14.2 to fit the decimal sign and the leading minus sign... YAY!!!   

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!

How to Concatenate Values

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.

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
  • 3 replies
  • 1291 views
  • 0 likes
  • 2 in conversation