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);
Hi @knveraraju91,
Please use double quotes in the second LIBNAME statement. Single quotes prevent the resolution of macro variable reference &xptdata.
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 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.