SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Associate data.xpt and formats.xpf from Stata into SAS

Accepted Solution Solved
Reply
Regular Contributor
Posts: 228
Accepted Solution

Associate data.xpt and formats.xpf from Stata into SAS

[ Edited ]

Hi there.

 

May I please ask how can I associate the format.xpf with the SAS data. I have two files generated from Stata fdasave command i.e. data.xpt and formats.xpf.

 

In order to browse the SAS data after the first proc copy, I needed to supress the formats in the datastep.

The second 'proc copy' only creates a SAS dataset with variable FMNTNAME, START and LABEL.

 

Your help is much appreciated.

 

 

libname sasfile "\\Desktop\Attempt";

libname xptfile xport "\\Attempt\data.xpt";
proc copy in=xptfile out=sasfile memtype=data; run;
data temp; set sasfile2.data; format _all_; run;


libname xptfile xport "\\Attemp\formats.xpf";
proc copy in=xptfile out=sasfile; run;

 

 

 

 


Accepted Solutions
Solution
‎05-16-2016 11:29 PM
Super User
Posts: 5,424

Re: Associate data.xpt and formats.xpf from Stata into SAS

Import formats data set first.
Use that as input to a proc format using the cntlin option. Store the output formats in Sasfile.
Point the fmtsearch option there.
Then import your data. Now your formats should work, given the they match.
Data never sleeps

View solution in original post


All Replies
Solution
‎05-16-2016 11:29 PM
Super User
Posts: 5,424

Re: Associate data.xpt and formats.xpf from Stata into SAS

Import formats data set first.
Use that as input to a proc format using the cntlin option. Store the output formats in Sasfile.
Point the fmtsearch option there.
Then import your data. Now your formats should work, given the they match.
Data never sleeps
☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 728 views
  • 0 likes
  • 2 in conversation