Help using Base SAS procedures

Migrating mainframe SAS to PC

Reply
Occasional Contributor
Posts: 5

Migrating mainframe SAS to PC

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.

Super User
Posts: 11,343

Re: Migrating mainframe SAS to PC

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.

Super User
Posts: 10,044

Re: Migrating mainframe SAS to PC

Try this one :

 

libname xx cvp '/folders/myfolders/';
proc copy in=xx out=work noclone;
run;
Occasional Contributor
Posts: 5

Re: Migrating mainframe SAS to PC

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.

SAS Employee
Posts: 13

Re: Migrating mainframe SAS to PC

[ Edited ]

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.

Occasional Contributor
Posts: 5

Re: Migrating mainframe SAS to PC

Posted in reply to maggiem_sas

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

SAS Employee
Posts: 13

Re: Migrating mainframe SAS to PC

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!

Occasional Contributor
Posts: 5

Re: Migrating mainframe SAS to PC

Posted in reply to maggiem_sas

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" ?

 

Occasional Contributor
Posts: 5

Re: Migrating mainframe SAS to PC

Posted in reply to maggiem_sas
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. -##
Super User
Posts: 10,044

Re: Migrating mainframe SAS to PC

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;
Ask a Question
Discussion stats
  • 9 replies
  • 421 views
  • 0 likes
  • 4 in conversation