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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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