BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

LOCALE option is definitely a way to control this. 

See this page  https://documentation.sas.com/doc/en/vdmmlcdc/1.0/nlsref/n1vgdzmvojqmbqn1h4v6nroijf4v.htm

 

If EBCDIC is the native format, no conversion occurs.
On ASCII systems, the $EBCDIC w. format is based on the default encoding value of the LOCALE= option that is specified when SAS starts. For example, if the locale was set to en_US locale, the default encoding that is used by the $EBCDIC w. format is Open_ed-1047. If the locale is de_DE (German_Germany), the default encoding that is used by the $EBCDIC w. format is Open_ed–1141. For a list of locales and encoding values, see Default Values for the DFLANG, DATESTYLE, and PAPERSIZE System Options Based on the LOCALE= System O....
You can specify the translation table that is used to map characters between EBCDIC and ASCII by using the MAPEBCDIC2ASCII system option. For more information, see MAPEBCDIC2ASCII= System Option.

The MAPEBCDICTOASCII (or MAPE2A but definitely not MAPEBCDIC2ASCII) option is probably trickier to modify and I wouldn't use that if you can get the results you want with the LOCALE option instead.

 

alepage
Barite | Level 11

Hello,

I have made a lot of tests with your help (thank you very much). But I came to the conclusion that none of the encoding option is working neither the kcvt function because, in our program, a lot of input variables are formated in ebcdic format.

 

options dflang='english';
options locale=EN;

proc options;
run;

%let SrcPath=/finsys/bicoe/BICOE/CR_SR_Prj/LEGO_1259/EBCDIC_files;
%let  ebcdicfname=pq.pxdwxqx.sefipaac.q92.ftp.d20210803b;

Data test;
infile "&SrcPath/&ebcdicfname." lrecl=3000 recfm=f ;
input @2042 email $char71.;
input @2042 email2 $EBCDIC71.;
email3 = kcvt(email,'e037','wlatin1');
run;

Data test;
infile "&SrcPath/&ebcdicfname." lrecl=3000 recfm=f ;
input @2042 email2 $EBCDIC71.;
email4 =tranwrd(email2,'à','@');
run;

The email3 works fine but we can not use it since in our programs, many input statements use an EBCDIC format.

Regarding the encoding ='something' into the infile statement, none that I have tested gave the appropriate results.

 

I have tests many options and I don't know what's going on with our SAS EG setting but I was unable to find a proper encoding setting that will works with our original sas programs.

 

Therefore, the only option that remain workable is the tranwrd option. 

I thought that with your help, we could find a proper setting but none of the options gave me the expected results.

 

Thank again for your help.

Patrick
Opal | Level 21

I haven't read through all of the posts here but if there is really no ootb way to get the character translation right then Proc Trantab allows to create your own translation table:

https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/nlsref/p140vpknze29j0n1rbfs5fcxemu3.htm 

alepage
Barite | Level 11

Hello,

The task we need to do is to pick an table coded in ebcdic format, convert it into ascii then convert this table in sas spde format.

I have been of the web last evening and I did not find any good example how to use the proc tranlab .

 

So I wonder if it could be possible to provide an example how to use that procedure .  I have been on You tube and I did not find any video on it.

 

Thanks in advance for your help

Tom
Super User Tom
Super User

I doubt that TRANTAB is the solution.  That is just still there for backwards compatibility with older versions of SAS.

 

Step one is to open a ticket with SAS support and have them explain to you why your SAS installation is using a different definition of $EBCDIC informat than what I am seeing.  They might have a simple solution.  It might be something that SAS has done and they can explain. It might be something about how your installation of SAS is configured and they can help figure that out also. 

 

If there is no simple configuration or option change solution then it might be easiest to add a step to your existing code to post-process the resulting text strings.

 

So if the code is just reading in binary text file AA and making some number of character variables using $EBCDIC informat to create SAS dataset XX.   You could then just add a step that updates that dataset by looping over all character variables and running whatever code is needed to correct the format issue.  That might be a simple KCVT() call. It might be two KCVT() calls.  It might be a simple TRANSLATE() call.

data xx;
  set xx;
  array _c _character_;
  do over _c;
    _c = translate(_c ,'@','E0'x);
  end;
run;

You might create a macro to do that which takes the dataset name as input so you can quickly add that step in as many places as you need.

alepage
Barite | Level 11
It seems that the issue is in the conversion from EBCDIC to spde
Any idea how to solve that issue?
SASKiwi
PROC Star

Please post the complete SAS log of how you converting from EBCDIC to SPDE including notes etc.

SASKiwi
PROC Star

Using the $EBCDIC format is only necessary if you are processing an EBCDIC file on an ASCII SAS platform - that is not a mainframe. Also the EBCDIC file must have been transmitted using a BINARY transfer to your ASCII platform. If you didn't use a BINARY transfer then conversion to ASCII would have happened producing unpredictable results. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 37 replies
  • 1184 views
  • 5 likes
  • 6 in conversation