06-14-2016 11:57 AM
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.
06-14-2016 12:05 PM
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.
06-15-2016 10:59 AM
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.
06-17-2016 04:32 PM - edited 06-17-2016 04:48 PM
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.
07-14-2016 12:26 PM
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?
07-14-2016 01:03 PM
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!
07-14-2016 04:28 PM
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" ?
07-20-2016 03:43 PM
07-20-2016 09:15 PM
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;