BookmarkSubscribeRSS Feed
leisas
Calcite | Level 5

I have a project which will need generate 20 files.

When I use base SAS 9.3, I can do it by the following codes

%let path=C:\Decision Support\Brown;

%put &path;

OPTION NOTES;

proc sql noprint;

   select count(distinct LMES)

      into : N

      from RDRVUSER.PROFECLM;

   select distinct LMES

      into :LMES1 - :LMES%left(&N)

      from RDRVUSER.PROFECLM;

quit;

%macro LMES;

%DO i=1 %to &N;

      data A&&LMES&i;

         set RDRVUSER.PROFECLM;

         if LMES="&&LMES&i";

      run;

   %end;

%DO i=1 %TO &N;

  PROC EXPORT DATA=A&&LMES&i

              OUTFILE="&PATH\PRC_NC&&LMES&I...CSV"

              DBMS=CSV REPLACE; RUN;

%END;

%MEND LMES;

%LMES;                 

Can this be done in EG? or any other advanced alternatives provided by EG that I can work with?

Any input will help and thanks!

4 REPLIES 4
LinusH
Tourmaline | Level 20

Well, you have the code, haven't you tested it?

If you got write access to the directory on the server, it should work.

If it works, why do you need any other means, are you not happy with the existing solution?

You can export data by using the export tasks. They act locally however. And if you need that macro logic, I suggest that you stick with what you got.

Data never sleeps
leisas
Calcite | Level 5

I did try running the codes in EG, but it always gave error msg. I guess it was server issue. The error msg is 'ERROR: Insufficient authorization to access /sas/sas94/config/Lev3/SASApp/C:......'.

If exporting files from EG 'Export', it will need some manual works - export files one by one. But I think it got to be a better way to export FILES in EG since it is a powerful tool. 

Thanks you for your input. Hope EG will improve this soon.

TomKari
Onyx | Level 15

This is one that comes up frequently with new Enterprise Guide users.

A key concept in EG is that although you are running EG on your windows desktop, the SAS software that is actually executing the SAS code may or may not be running on your desktop. Enterprise Guide is designed to work with SAS instances both on your desktop and on remote servers.

In your case, because you're receiving diagnostics with directory names that look like "/sas/sas94/config/Lev3/SASApp", I can tell you that your SAS code is running on a Unix server.

That means that i) you'll need to provide library and file references using Unix syntax instead of Windows and ii) you'll need to know what directory locations you can write to.

There should be a SAS administrator at your organization (who installed and supports all this stuff), and they should be able to provide advice about how the environment is set up.

Tom

CaseySmith
SAS Employee

If your code above works in Base SAS, then it should work fine submitted from EG as well.

By the way, EG provides point-and-click export capability, but it is obviously not as flexible as what you can achieve with code (your code above is a good example).


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1371 views
  • 1 like
  • 4 in conversation