%LET study=EDUC2017;
filename &study "C:\DP\ELE\DDI\&study..xml";
filename SXLEMAP "C:\DP\ELE\DDI Tables\ELEExplorer.map";
libname &study xmlv2 xmlmap=SXLEMAP access=READONLY;
libname OUT "C:\DP\ELE\DDI\Data";
DATA OUT.titlStmt2; SET &study.titlStmt2; run;
DATA OUT.producer; SET &study.producer; run;
DATA OUT.fundAg; SET &study.fundAg; run;
DATA OUT.stdyInfo; SET &study.stdyInfo; run;
DATA OUT.sumDscr; SET &study.sumDscr; run;
DATA OUT.dataColl; SET &study.dataColl; run;
DATA OUT.qstn; SET &study.qstn; run;
DATA OUT.var; SET &study.var; run;
DATA OUT.catgry; SET &study.catgry; run;
DATA OUT.catStat; SET &study.catStat; run;
The error I'm getting is " File WORK.EDUC2017CATSTAT.DATA does not exist."
change SET &study.X
to SET &study..X
It might also be worth looking into proc datasets to copy files from one library to another.
proc datasets lib = &study.;
copy out = out;
select dataset1 dataset2 dataset3; /*** List of datasets you want copied ***/
quit;
run;
This is where putting the point at the end of macro variables is very important:
This:
SET &study.titlStmt2;
As there is only one . that closes the macro name, so there is no dot between lib and dataset, should be:
SET &study..titlStmt2;
Following good programming practices will help you avoid these types of errors - e.g:
Always finish a macro variable with a .
(Other tips, avoid coding in uppercase, one line per statement, avoid use of keywords like var in names
Thank you, that worked as expected. I will consider your other 'best practices' suggestions.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.