BookmarkSubscribeRSS Feed
Inp
Obsidian | Level 7 Inp
Obsidian | Level 7
Here is my problem

I am reading a flat file on the mainframe using SAS spawner. One of the input reading field is
@0198 DESCRIPT $CHAR45.
.
When I read it, one of the following filed value on the file(input file) is
toifcitrixc14p. Endpoint Unreachble
After I read, I see the value in the SAS dataset is
toifcitrixc14p'box' Endpoint Unreachble
Note that , here I write box instead of box character because I am not able write a box char.

When I put the following option

infile info lrecl=700 pad ignoredoseof.


I see the following error message.

3 infile info lrecl=700 pad ignoredoseof;
-------------------
23
ERROR 23-2: Invalid option name IGNOREDOSEOF.



Can any one help me out, how to ignore this box char when I read the file. because when I write back to text file, it shift all fields after the filed DESCRIPT.



Thanks

Inpan
4 REPLIES 4
Doc_Duke
Rhodochrosite | Level 12
The "box" is a character that can't be printed in your current character set. It is probably a tab character.

You can find the hex code for the character by using a PUT statement and formatting DESCRIPT using the HEX format. Then you can manipulate or remove it using the various character functions in SAS.

Doc Muhlbaier
Duke
Inp
Obsidian | Level 7 Inp
Obsidian | Level 7
Thank so much Duke.
I know I can use Compress function to suppress the box char, if I find the hex value of the box char. But is it possible to find any options to ignore globally any special char like this when I read any input that have special char because I don't know if other variable have the same issue.




Thanks

Inpan
Patrick
Opal | Level 21
Hi Inp

If I understand that right then you want to have SAS to solve an issue which you have with your data.
It sounds to me as if you will need some data cleansing after reading the data. You could use translate for that - translating a defined set of special characters to blanks.
More general would be to use Perl Regular Expressions (have a look at PRXCHANGE), "\s" matches all whitespace characters - that is what most probably then shows up as a 'box'. So just translate all whitespace characters to blanks.

Something close to the following should do the job:
data ...
PID=PRXPARSE ('s/\s/ /io');
infile .... truncover;
input @;
call PRXCHANGE(PID,-1,_infile_);
input @1 var1 @3var2;
...

Your file and all the processing happens on the Mainframe (EBCDIC) but you see the result in an 'ASCII environment (EG?). It could be (less likely) that there is some problem with the translation (trantab) between this two environments.

To see the special character in your Mainframe file use your Mainframe editor and type on the command line "Hex on"; a tab (the most likely problem char) would have the Hex value 05.

HTH
Patrick

P.S: forget about 'pad', just use 'truncover' Message was edited by: Patrick
Inp
Obsidian | Level 7 Inp
Obsidian | Level 7
Hi Pat,
Thank you so much ; Your solution resoved my problem, sorry for my late response.


Thanks


Inpan

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