Desktop productivity for business analysts and programmers

Can I code proc export from EG?

Reply
Contributor
Posts: 24

Can I code proc export from EG?

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!

Super User
Posts: 5,391

Re: Can I code proc export from EG?

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
Contributor
Posts: 24

Re: Can I code proc export from EG?

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.

PROC Star
Posts: 1,146

Re: Can I code proc export from EG?

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

SAS Super FREQ
Posts: 307

Re: Can I code proc export from EG?

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).

Ask a Question
Discussion stats
  • 4 replies
  • 342 views
  • 1 like
  • 4 in conversation