SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Robin_moon
Fluorite | Level 6

sI tried to convert two xpt file called "ae.xpt" and "se.xpt" into sas file called ae and se as well. The original file was saved at "D:\sdtm\data_xpt", and I want the converted sas file to be saved at "D:\sdtm\data_sas".

 

Here was my code, but it didn't work:

libname sasfiles 'D:\sdtm\data_sas';

%let Root=D:\sdtm\data_xpt;
%xpt2loc(libref=sasfiles, memlist=ae, filespec='&root\ae.xpt');
%xpt2loc(libref=sasfiles, memlist=se, filespec='&root\se.xpt');

How to write the correct one? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

The macro processor will ignore strings that are bounded with single quote characters (apostrophes).

Use double quote characters instead.

You probably don't need to limit the list of members to extract.  If the XPT file only has one member then there is no difference.  If it has multiple members then why do you only want one of them?

%let Root=D:\sdtm\data_xpt;
%xpt2loc(libref=sasfiles, filespec="&root\ae.xpt");

 

View solution in original post

2 REPLIES 2
Ksharp
Super User
libname sasfiles 'D:\sdtm\data_sas' ;
filename x 'D:\sdtm\data_xpt\ae.xpt' ;
%xpt2loc(libref=sasfiles, filespec=x ) 
Tom
Super User Tom
Super User

The macro processor will ignore strings that are bounded with single quote characters (apostrophes).

Use double quote characters instead.

You probably don't need to limit the list of members to extract.  If the XPT file only has one member then there is no difference.  If it has multiple members then why do you only want one of them?

%let Root=D:\sdtm\data_xpt;
%xpt2loc(libref=sasfiles, filespec="&root\ae.xpt");

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1326 views
  • 3 likes
  • 3 in conversation