SAS: The . Manual
I stole that name from Chris Hemedinger for “The Missing Manual” because I thought it was hilarious. If you don’t program in SAS much then you probably did not think immediately, “Oh, . is the symbol for missing numeric data, how funny.”
In fact, you are probably more like my daughter, Maria Burns Ortiz, who when my husband asked her about a problem with her computer and said,
“Did you try zapping the PRAM, because that’s the first thing I would have thought of.”
Responded,
“No, the first thing I thought of was drop-kicking it.”
Of course, Maria now works for ESPN doing interviews about Olympic snowboarders who get girls to kiss their medals while we are here discussing SAS. So, we may debate who was the wiser.
The unpredictability of XPT files
XPT files, a.k.a. transport files used to be used to transport SAS files between operating systems. Say, you wanted to move your file from a Windows machine to Unix. Nowadays, you don’t need to do a thing. You can just use Filezilla, download your SAS file and it pops right open. There may be cases when you want to use XPT. My computer complains that the file was created on another operating system, but everything works just fine so I ignore it.
One thing XPT files are really cool for is let’s say you are like me and you DON’T have a metadata server set up, but you would still like to use the SAS files you have in JMP. Simply do this:
LIBNAME in “/home/directory/subdirectory/ ” ;
LIBNAME outfile xport “/home/directory/subdirectory/filename.xpt” ;
PROC COPY IN = in OUT= outfile MEMTYPE = DATA ;
SELECT filename ;
RUN ;
You can open XPT files right up in JMP, no problem
You can download that .xpt file and open it up in JMP. Pops right open and all is hunky-dory.
Incidentally, you can also open it in Stata using the fdause command.
XPT decides to be difficult
Very oddly, xpt do NOT pop right open in SAS Enterprise Guide, nor in SAS. I needed to actually write three lines of code, taking up time that I could have used to eaten a jelly bean.
I am quite upset by this because I am inordinately fond of jelly beans. Here is what I needed to write:
libname in xport “e:\filename.xpt” ;
data newfile ;
set in.allmem ;
Note something here. The member that you want may not be the same as the name of the file. What if, as often happens to me, the dataset was left on your desk in a brown paper bag labeled “Beware of the Leopard”, or created by your former colleague who was escorted from the building on what he was told was his last day murmuring that you jerks would be first against the wall when the revolution came. What then?
If you are using SAS 9.whatever it is easy. First, run just that first line to assign your library, then click on the Explorer tab, double-click on the Library named IN and you’ll see the member name.
If you are using Enterprise Guide you may need to hunt a little to find the library because it was misplaced while its author was laying on the beach drinking wine and not watching it better.
From the PROGRAM menu select NEW PROGRAM and run the same LIBNAME statement.
In the bottom left menu you’ll see this image. Click on the third button to bring up your servers. In my case, the file is on the local server, I click on Libraries, then the Library name and I spot the name of my file.
Weird facts about SAS 9.2 on Windows 64
Extremely strange but true. If you are running SAS 9.2 x 64 on Windows 7 on a virtual machine created with VMware it only works if the VM was created using the “more isolated” option. If your VM was created using the “more seamless option” SAS will not run. (A less ungrateful person than me would remember the name of the person at SAS Tech Support who told me this.)
If you already created your VM using the more seamless option you only have two choices. If, as in my case, there wasn’t really anything of importance on your virtual machine, just delete it and create a new one using the more isolated option. Install SAS 9.2 on that and it runs just fine. Option B is to create a new virtual machine and install SAS on that, because it is NOT going to install on the one you have, so just deal with it. It really is not a big deal having two VMs for different uses. I have six, with six different operating systems.
Oh, speaking of SAS 9.2 for Win 64, here is a known problem with this version on Windows 64, both Vista and Windows 7. The Import Data option from the file menu does NOT read in Excel files. You can still import Excel files like this:
Proc import out = sasdatasetname
datafile = “drive:\directory\filename.xls”
dbms = xls replace ;
sheet = “sheet-name” ;
The export works similarly. You can find more information at http://support.sas.com/kb/33/228.html
Disappearing CGF file: Another note on SAS on VM
If you have two hard drives defined, say D & E you may find that your VM won’t recognize certain things like a USB drive because it assumes that is E but E is already taken up. So, trying to be clever, you rename your drive to something else, say H.
However, the next time you start your computer and SAS doesn’t work,in fact it gives you a message like E:\ .. \SASV9.CFG is unreadable.
Of course it is, because this drive is now named H! The simplest fix (other than not having named it E: in the first place or only having one virtual disk, but it is too late for that now) is to go to Control Panel, Select Administrative Tools and then Computer Management. Select Storage and then Disk Management. Right click on the drive you need to change and select Change Drive Letter and Paths. Change it back to the letter you had changed from. If you don’t know, look at that error message you got. Whatever it says, in this case E:, is the drive you changed from. Change it back. Restart your computer.
SAS works.
Don’t change the drive letter for the disk that SAS is installed on again.
I checked – it was John Maxwell in Tech Support who told you about the “isolated” VM. Medal-kissing is optional.
Marie – the xpt engine was pre version 9 – the “new” way is to use proc cport to create xport files and proc cimport to import them. Has the additional advantage that it handles catalogs.
for example:
/* contents of Rawdata folder */
filename cport2 “path-to-output-xport-file\sasds.xpt”;
proc cport library=RAWDATA file=cport2;
/* exclude filesign xyzcount; */
run;
To correct a common misunderstanding, SAS
export files can have anything as a file extension: yourfilename.foo
Interesting. I’d never thought about that.