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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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