|

Success! With SAS Web Editor

My saga on uploading and reading an older data set into SAS Web Editor

1. Use FTP to upload

So, I did get my data uploaded to SAS Web Editor using ftp. Little hint here, if you are using Filezilla and having trouble connecting, check to make sure that Filezilla is not using sftp. Sometimes in the box labeled Host it will be prefaced with sftp as in sftp://sascloudftp etc. Remove the s so it just says, for example, ftp://sascloudftp.sas.com . I wrote about that previously so I’m not repeating myself here.

2. Use PROC CPORT to export the formats

This is not always necessary but IF, as I mentioned yesterday, you have a problem reading the formats, this is your next step and thanks to Tom Edds from SAS for suggesting it. One thing PROC CPORT allows you to do is transfer data sets from older versions of SAS to newer ones.

Run this program on your desktop (assuming the data are located on your Windows machine).

FILENAME trans “C:\Users\AnnMaria\Documents\oldpeople\sasdata\trans” ;
LIBNAME in “h:\sasdata” ;
PROC CPORT LIBRARY= in FILE = trans MEMTYPE = CATALOG ;

The FILENAME statement specifies where you want your transport file written, the LIBNAME statement is where your format catalog is located.

So, this created a transport file to upload.

3. USE PROC CIMPORT to import the formats

Run this program on SAS Web Editor

FILENAME mydata “/courses/myuniv/dir/otherdir/trans” ;
LIBNAME test “~/Projects/oldpeople/sasdata/formats/ ” ;
PROC CIMPORT LIBRARY = test INFILE = mydata ;

The FILENAME statement refers to the file you created in the previous step.

The LIBNAME statement is where you want the formats written. This directory must already exist.

4. Now you’re ready to access your data using SAS Web Editor

LIBNAME in “/courses/myuniv/dir/otherdir/” access=readonly;
LIBNAME saslib “~/Projects/oldpeople/sasdata/formats/ ” ;
OPTIONS FMTSEARCH = (saslib) ;

The first LIBNAME statement is the course directory where you uploaded your data .

The second LIBNAME statement is the folder in the Projects folder where you stored the formats. You could put them in a subdirectory of the same course directory where you uploaded your data. You could put them almost anywhere, really.

OPTIONS FMTSEARCH = tells SAS where to search for the formats it expects.

 

P.S. Thanks to Tom Edds from SAS for suggesting the cport/cimport .

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *