BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Dear sir/madam,

 

I am using the following Macro to convert SAS data sets to SAS xport files to run open cdisc. At the end I see only last one, in this case the VS. In the transport folder, I see name as &xptdata. rather than name of dataset.  Everything else is replaced by previous one. Please help in my code.

 

%macro xpt_sas (xptdata = );
LIBNAME misc 'C:\Users\ss\Desktop/sas';
libname &xptdata. xport 'C:\Users\ss\Desktop/sasx/&xptdata..xpt';
proc copy in=misc out=&xptdata.;
select &xptdata. ;
run;
%mend;

%xpt_sas (xptdata = AE); %xpt_sas (xptdata = CM); %xpt_sas (xptdata = CO); %xpt_sas (xptdata = DM); %xpt_sas (xptdata = DS); %xpt_sas (xptdata = EG); %xpt_sas (xptdata = EX); %xpt_sas (xptdata = LB); %xpt_sas (xptdata = MH); %xpt_sas (xptdata = SE); %xpt_sas (xptdata = SUPPAE); %xpt_sas (xptdata = SUPPCM); %xpt_sas (xptdata = SUPPDM); %xpt_sas (xptdata = SUPPDS); %xpt_sas (xptdata = SUPPEG); %xpt_sas (xptdata = SUPPEX); %xpt_sas (xptdata = SUPPLB); %xpt_sas (xptdata = SUPPVS); %xpt_sas (xptdata = SV); %xpt_sas (xptdata = TA); %xpt_sas (xptdata = TE); %xpt_sas (xptdata = TS); %xpt_sas (xptdata = TV); %xpt_sas (xptdata = VS);

 

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hi @knveraraju91,

 

Please use double quotes in the second LIBNAME statement. Single quotes prevent the resolution of macro variable reference &xptdata.

jklaverstijn
Rhodochrosite | Level 12

Hi @knveraraju91

 

It would help a great deal if you could add the SAS log of your program execution. I thuink there are some pointers in there.

 

For one I think the forward slashes in the pathname of libname misc could be a typo that throws things off. But the log is very important; make it a habit to always include it if you want someone's help.

 

Regards,

Jan.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 1054 views
  • 2 likes
  • 3 in conversation