SAS Procedures

Help using Base SAS procedures
BookmarkSubscribeRSS Feed
Mike_Davis
Fluorite | Level 6

Hello everyone,

I know we can use SAS x command to open outside file or application such as Excel using code 1 as follow:

Also we can use another method to open excel :see code 2

My question is Could we open Excel in background? I mean open excel at invisible status,,,if this is not available,,, open  excel at its minimized window status will be another alternative solution.

Because I don't want the opened excel appear and cover our SAS console.

Thanks

Mike

code1:

options noxwait noxsync;

x '"C:\Program Files\Microsoft Office\Office12\EXCEL"';

code 2:

OPTIONS NOXWAIT NOXSYNC;

DATA _NULL_;

RC=SYSTEM('START EXCEL');

RC=SLEEP(3);

RUN;

4 REPLIES 4
art297
Opal | Level 21

      PUT '[app.minimize()]';

Mike_Davis
Fluorite | Level 6

Thank you Art,

The PUT function works well to minimize  a new opened excel file.
but how to minimize Excel console before opened an excel file?

because if we want to open a excel file ,at first we should open Excel console firstly use one of  the following SAS codes:


options noxwait noxsync;

x '"C:\Program Files\Microsoft Office\Office12\EXCEL"';

or:

OPTIONS NOXWAIT NOXSYNC;
DATA _NULL_;
RC=SYSTEM('START EXCEL');
RC=SLEEP(5);
RUN;


what I want to minimize firstly is the Excel console.

Thank you!

Mike

art297
Opal | Level 21

Mike,

Once you get a solution mark the thread as being answered.

Given what you want to do, forget my previous advice of using app.minimize()

The answer is a bit convoluted, but works.

First, create a special shortcut for Excel.  I did that by going to where Excel was located on my computer, right clicked on it, and then clicked on create shortcut.

I then created a folder, under Office11 (which I named test) and then dragged the shortcut to that folder.

Then I right clicked on the shortcut and renamed it to be excel.  Then (still within properties) I set the value of run to be minimized.

After doing that, I changed the SAS code to open that link rather than opening Excel directly.  Having done that, Excel never appeared on the screen, but everything was accomplished.  The code I ran was:

%let pw=abcdefg;

options noxwait noxsync;

x '"C:\Program Files\Microsoft Office\Office11\test\EXCEL.lnk"';

data _null_;

  x=sleep(3);

run;

filename ExcelCmd dde 'Excel|system';

data _null_;

  file ExcelCmd;

  s = '[open(' || quote ("c:\trialdata.xls.") ||",,,,""&pw."")]";

  put s;

run;

Mike_Davis
Fluorite | Level 6

Thank you Art,

also I found an option works well ,but just for mininize ,can't run at background or invisible:

options noxwait noxsync xmin;

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4552 views
  • 3 likes
  • 2 in conversation