BookmarkSubscribeRSS Feed
dgrolling
Calcite | Level 5

 

%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."

4 REPLIES 4
DanielLangley
Quartz | Level 8

change SET &study.X

to SET &study..X

DanielLangley
Quartz | Level 8

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;
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

dgrolling
Calcite | Level 5

Thank you, that worked as expected. I will consider your other 'best practices' suggestions.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

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
  • 4 replies
  • 1306 views
  • 2 likes
  • 3 in conversation