BookmarkSubscribeRSS Feed
jtb2o2
Calcite | Level 5

I'm trying to convert a SAS dataset (9.4) to a .dbf file.  I want to keep the lengths I specified in SAS.  I can do this using the StatTransfer product, thru the interface.  HOWEVER, we would like to directly call StatTransfer from SAS and run it there.  I have managed to do this with the following call in SAS:

%SYSEXEC("C:\Program Files\StatTransfer12-64\st.exe" "U:\Jackie\sasdata\s001_combine001.sas7bdat" "U:\Jackie\sasdata\testdata.dbf" /Y );

This does NOT keep my lengths.  I tried contacting StatTransfer and after much arguing and explaining they told me to try using a SET command and copy.  I tried the following from a DOS prompt after executing the st.exe command:

SET read-sas-fmts y

COPY "U:\Jackie\sasdata\s001_combine001.sas7bdat" "U:\Jackie\sasdata\testdata.dbf"

Still no luck keeping the formats.  I thought I would throw it out here to see if anyone has any suggestions.

Thanks for your help!

4 REPLIES 4
LinusH
Tourmaline | Level 20

I don't think that you from the SAS point of view can affect the outcome from a 3rd party product like this.

You are probably best off contacting support/forums for StatTransfer instead.

Data never sleeps
ballardw
Super User

You say in the start of your question " I want to keep the lengths I specified in SAS" but later say "Still no luck keeping the formats".

Formats are not lengths nor vice versa. Which did you as the tech support length or formatted value?

A possible work-around would be to create the text versions of the variables using

TextVarX = Put(VarX, format_for_varX.);

statements and exporting that data set.

jtb2o2
Calcite | Level 5

Sorry, you are correct.  Most important is that I keep the length of the fields.  So, if the field length is set to 50, but the longest value within it is 32, I still need the field to be set up as a length of 50.

Tom
Super User Tom
Super User

Why are you converting to a file format that was abandoned over 20 years ago?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 775 views
  • 1 like
  • 4 in conversation