BookmarkSubscribeRSS Feed
Chris99
Calcite | Level 5

Confession: ignorant about SAS, but pretty good at converting mainframe files in general.

 

We've got some 15-20 year old SAS files on a few mainframe tapes.  My client would like to be able to use these on his PC.  

 

(a) If I can extract the files properly, does the PC version have the ability to import them?

 

(b) On tape, these files have 4-byte block headers and 4-byte record headers.  Would the PC import feature (if it exists) want either or both of these removed? 

 

Thanks for any help.

9 REPLIES 9
ballardw
Super User

What you are looking for is to generate Transport files. That creates SAS data into forms that can be transferred between operating systems.

The question is if you can read them as SAS datasets. If so then look at Proc Cport to create the files and Proc Cimport on your client's end to read them.

Ksharp
Super User

Try this one :

 

libname xx cvp '/folders/myfolders/';
proc copy in=xx out=work noclone;
run;
Chris99
Calcite | Level 5

Thanks for the answers, but I suspect those steps are to be performed on the source system. The old mainframe is no longer available to the client, and the files were created 15 to 20 years ago. Is anyone aware of a way to deal with such files on the target (PC) system?

 

 

p.s. - We once hacked away and came up with a PC-based coverter for 30+ year old SPSS files, but it was a BIG effort, probably not justified in this case.

maggiem_sas
SAS Employee

Try the code from @Ksharp. PROC COPY can run on the target environment. To do this, you must be able to access the source environment from the target. I believe SAS/CONNECT or SAS/SHARE could do this for you if you have it licensed, but not sure since I'm not familiar with mainframe. In Ksharp's code, the source environment is specified on the LIBNAME statement. That libref (Ksharp called it xx but you call it whatever you want in 8 characters or less) is then specified on the IN= argument of PROC COPY.

 

If you want a permanent library, add another LIBNAME statement for the target instead of using OUT=Work. Using Work is a good first test though, because it is a temporary location.

 

The CVP on the source LIBNAME statement specifies to use the CVP engine, which increases the length of your character variables by 1.5x the source to reduce the chance of truncation. You can use CVP options to add more length if 1.5x is not enough. The NOCLONE option converts from the mainframe encoding to the current session encoding, among other things.

 

See the documentation for PROC COPY. It links to the COPY statement of PROC DATASETS for details. Same basic functionality. Run a PROC DATASETS with CONTENTS statement to check the contents of your migrated test library.

Chris99
Calcite | Level 5

Thanks again, but I think that Ive hacked my way through the file format. We should be able render it into XML. I see there are some powerful XML ingestion tools in SAS, but so far, I haven't found a way to try them in my University Edition. Has any done any reading of XML via University?

Chris

maggiem_sas
SAS Employee

This page : http://support.sas.com/rnd/base/xmlengine/ links to a couple of neat videos and a tip sheet about the SAS XML engine. They aren't specific to the SAS University Edition, but they might be helpful. Or you might have already progressed beyond their help!

Chris99
Calcite | Level 5

Thanks very much. It looks like the XML capabilities are strong.  I wish I could test them "on campus" (SAS-U).

 

BTW, part of the basis for these questions is that I did something similar a few years ago with very old (pre-1985) SPSS mainframe files. They are *totally* incompatible with more recent SPSS. So we, hacked the file format and then converted to an XML structure that the client could then read into more recent SPSS.  Maybe there is someone out there with some very old SPSS files on tape that would like to convert to SAS?  Would it be OK to start a new posting labelled "Ancient SPSS" ?

 

Chris99
Calcite | Level 5
Hi Maggie.

Thanks very much. That's good stuff. It seems that the XML import features
aren't available in SAS-U.

Chris

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Ksharp
Super User

You can import XML file in SAS-U.

 

 

filename xx temp;
libname xx xmlv2 '/folders/myfolders/x.xml' automap=replace xmlmap=xx;
proc copy in=xx out=work;
run;

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