Help using Base SAS procedures

Proc cimport not working properly

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

Proc cimport not working properly

SAS beginner, I am working with SAS University edition to look at a public dataset from 2007, and when you download the zip file to obtain the data, it contains an import/transport file (.sas), a formats file (.sas7bcat), and the data file (.v8x). It also contains a PDF with some instructions. I was instructed to put everything in one folder, make a library for it, then open the import file and run the following code which runs without errors:

 

filename FILE1 "PATH ON COMPUTER WHERE DATA FILE IS FOUND\hints2007.d2009_02_12.public.v8x";

proc cimport file=FILE1 data=SUBSTITUTE LIBRARY AND FILE NAME HERE;
run;

The 3 notes that come out of this are:

 

NOTE: PROC CIMPORT begins to create/update data set WORK.HINTS32
NOTE: Data set contains 473 variables and 7674 observations.
Logical record length is 4608
NOTE: PROCEDURE CIMPORT used (Total process time):
real time 1.24 seconds
cpu time 1.03 seconds
 

 

Then I do:

 

Options fmtsearch=(libraryname);

 

Which also runs fine. My errors arise when I go to do some re-coding of variables using the formats. After "data ______;" and "set ______;" I get this error - 292 times, one for each formatted variable:

 

ERROR: File HINTS32.FORMATS.CATALOG was created for a different operating system.

 

Isn't this what the transport file is meant to take care of? Is there something wrong with they way they have instructed me to do this or the way I am executing it? I have tried meddling with it a little based on the SAS help pages, but this public dataset is heavily used so if there was some kind of mistake in their instructions I think someone would have noticed by now and amended. I assume I am doing something wrong, but what?


Accepted Solutions
Solution
‎12-29-2017 11:59 PM
Super User
Posts: 10,237

Re: Proc cimport not working properly

Posted in reply to psyscience

You only got the dataset in transport format, but the .sas7bcat is a normal catalog file, which is OS and version specific.

You either need

- the catalog in transport format

- SAS code to create the format (the proper method anyway)

- a dataset that can be used as a cntlin for proc format

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code

View solution in original post


All Replies
Solution
‎12-29-2017 11:59 PM
Super User
Posts: 10,237

Re: Proc cimport not working properly

Posted in reply to psyscience

You only got the dataset in transport format, but the .sas7bcat is a normal catalog file, which is OS and version specific.

You either need

- the catalog in transport format

- SAS code to create the format (the proper method anyway)

- a dataset that can be used as a cntlin for proc format

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Occasional Contributor
Posts: 5

Re: Proc cimport not working properly

Posted in reply to KurtBremser

Thank you, Kurt, I emailed yesterday looking for additional files and hope to hear from them soon.

FWIW, I looked at iterations of the survey from 2005 and 2011 this afternoon, and the format approach is completely different in all three. 2005 uses a macro which works beautifully and 2011 gives two .sas code files to accomplish this. This is probably not an efficient way for me to learn SAS!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 244 views
  • 0 likes
  • 2 in conversation