BookmarkSubscribeRSS Feed
Reeza
Super User

What are you trying to do? Opening an Excel with the code you've shown will do exactly that, open Excel which is pretty useless. 

 

Also, you have macro's shown but you're not actually calling them. Consider a macro similar (but not the same) as a function in another language. You've created the function but you haven't used it. You also may have an 'order of operations' issue. You define the SLEEP macro after it's used in the OPEN_XLS macro. 

 

Do note that DDE requires the XCMD option to be enabled and usually doesn't work on server environments because they're Unix not Windows and those are Windows commands. Also, it's ancient. That doesn't mean it's not useful, just that it's ancient, finicky and I wouldn't build anything with this today. 

 

%MACRO Sleep(pSeconds); 
DATA _NULL_;
vVar1=SLEEP(&pSeconds);
RUN;
%MEND;

%MACRO Open_Xls(); OPTIONS NOXWAIT NOXSYNC MISSING=''; X "C:\Program Files (x86)\Microsoft Office\Office15\EXCEL.EXE"; %sleep(2); %MEND;
%open_xls;

 

 

 

rajenr
Calcite | Level 5

@Reeza,

 

Actually my concern is need to restore datasets using sas program. I tried for for t he same. As suggested by you and @Kurt_Bremser, i tried to restore the datasets using commands in command prompt. But i didn't get the commands for the same. While searching regarding this i could see some VB codings for restore the SQL database files.

 

So i planned to use those commands in Excel. But while running the SAS program the excel macro also need to run.  If i can open the excel file then i will able to run the macro easily. So only i tried to open the file using the given commands. But i couldn't. Here i have some concerns, same are listed below.

 

1. Need to restore the datasets using SAS program.

2. If it is possible ways to do that and coding for the same.

 

Please help on this...

 

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

You seem to be going round in circles.  Start by defining - where did the data come from originally?  If you have the source files then re-import the data, if you don't have the source data, and you have removed the files, then you need ot go back to your IT and see if they have an automatic back up.  It hard to say as we have no information on your process other than your trying to restore something.  You need to provide all the infomation around the problem so we can know as well.

Kurt_Bremser
Super User

As already stated, you absolutely need to solve the "restore from commandline" issue first. If you can't do it from there, you can't do it, period. Involving another silly mechanism like Excel just to run a VB script borders on the insane.

 

How to run VB scripts from the commandline:

https://technet.microsoft.com/en-us/library/ee156587.aspx

(BTW, this is the first result of a google search for "run vb script from the commandline".

The same search also reveals lots of usable hints for the task)

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 18 replies
  • 1265 views
  • 1 like
  • 4 in conversation