SAS Health and Life Sciences

Health care analytics, drug development, real-world evidence, and more
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.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

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