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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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