BookmarkSubscribeRSS Feed
chouj
Calcite | Level 5

Hi Everyone,

I need to export a SAS dataset to Stata. I also have a SAS catalog which I keep all the user defined formats. The codes below are what I have tried so far without success. If anyone know how to do this, please help!

Thank you- Joanne 

 

libname ftest "";

PROC EXPORT DATA=df_rec
OUTFILE="H:\late_recurrence.dta"
DBMS=dta REPLACE;
fmtlib=ftest;
RUN;

 

3 REPLIES 3
Quentin
Super User

When you say "without success", can you explain what that means?  Did you get errors in the log?  Did the data export successfully but you were unhappy with the results?  If so, what was wrong with the results?

 

When you say "retain the format" in STATA, what does that mean?  SAS formats can be used like SPSS "value labels".  Assuming STATA has the same construct, is the problem that the data is being exported to STATA successfully, but the value labels are missing?

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
chouj
Calcite | Level 5
Hi,
I apologized for not being clear. I was able to run the proc export procedure and create a stata dataset without any issues. But all the format labels got lost in the Stata data. This is what I meant by without success.
Thank you -Joanne
Quentin
Super User

Hi,

 

This related thread might help:

https://communities.sas.com/t5/SAS-Procedures/Export-SAS-dataset-to-STATA-keeping-the-formats/td-p/6...

 

Are they numeric variables, and is the length of your format names <= 8 ?

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 652 views
  • 0 likes
  • 2 in conversation