BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
helpmedoubts
Fluorite | Level 6

How can we convert single xpt file to sas dataset? How can we convert group of xpt files to SAS datesets in a folder?

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
%let path_in=  D:\XiaKeShan\XPT   ;  /*XPT文件的路径*/
%let path_out= D:\XiaKeShan\SAS   ;  /*XPT文件转成SAS数据集的路径*/







libname out v9 "&path_out";
data _null_;
rc=filename('x',"&path_in.");
did=dopen('x');
do i=1 to dnum(did);
 memname=dread(did,i); 
 call execute(cat("libname tranfile xport '&path_in\",memname,"';proc copy in=tranfile out=out ; run;"));
end;
run;

View solution in original post

4 REPLIES 4
SASKiwi
PROC Star

I suggest you try the %XPT2LOC macro.

helpmedoubts
Fluorite | Level 6

Thank you.

Ksharp
Super User
%let path_in=  D:\XiaKeShan\XPT   ;  /*XPT文件的路径*/
%let path_out= D:\XiaKeShan\SAS   ;  /*XPT文件转成SAS数据集的路径*/







libname out v9 "&path_out";
data _null_;
rc=filename('x',"&path_in.");
did=dopen('x');
do i=1 to dnum(did);
 memname=dread(did,i); 
 call execute(cat("libname tranfile xport '&path_in\",memname,"';proc copy in=tranfile out=out ; run;"));
end;
run;
helpmedoubts
Fluorite | Level 6

Sorry for the late reply. Thank you.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

Discussion stats
  • 4 replies
  • 1389 views
  • 0 likes
  • 3 in conversation