BookmarkSubscribeRSS Feed
JasmineChia
Calcite | Level 5

The following are my line of codes that I've been trying to run on my SAS. Previously it was running ok with occasional error but lately I have been unsuccessful when running this code. I keep getting error where my SAS program will not respond then I will have to do a CTRL+ALT+DEL and kill the SAS program. I can't seem to decipher the error and failed to find any solution, these are just lines I copy from the Internet and it used to work fine. Can someone please enlighten me on this?

options noxwait noxsync;

x '"C:\Program Files\Microsoft Office\OFFICE11\EXCEL.exe"';

data _null_;

x=sleep(5);

run;

filename ddecmd dde 'excel|system';

data _null_;

file ddecmd;

put '[FILE-OPEN("C:\My Projects\Temp\Data Capture\CreateCSVFiles.xls")]';

run;

data _null_;

file ddecmd;

put '[FILE-CLOSE("C:\My Projects\Temp\Data Capture\CreateCSVFiles.xls")]';

put '[QUIT()]';

run;

9 REPLIES 9
ballardw
Super User

Which data step is not finishing?

Since you have 3 data steps run just one at a time to see which what may be going on as a first step.

By any chance have  you upgraded to a newer version of Office? The path to Excel would have changed.

JasmineChia
Calcite | Level 5

I can get through the first data step and successfully initiate my excel 2003, so I don't think it's the path problem, but after that my program will go into an infinite loop and stop responding, or so it seems to me. The problem seems to start at the 2nd data step. In the past I am able to open up the CreateCSVFiles.xls but not sure why now I can't do that anymore. I have also tried running other similar DDE program and failed at the part where I need to open the excel file (not initiate excel program).

I have updated my Windows once, so I'm not sure if this contributes to the error.

art297
Opal | Level 21

What are you trying to do with the files?  The code you sent: (1) starts excel; (2) opens a spreadsheet;

(3) trys to open the same spreadsheet (while the first one is still open) and then tries to quit.

JasmineChia
Calcite | Level 5

My original code is longer than this and does more thing than this. Right now I'm just trying to eliminate other unnecessary codes to find out what prompted my sas program to not respond. So I realised my program will stop responding whenever it tries to open CreateCSVFiles.xls.

Peter_C
Rhodochrosite | Level 12

JasmineChia

have you checked that no pop-up messages appear when you open the workbook directly in excel?

peterC

JasmineChia
Calcite | Level 5

Just an update, I realised that after I restart my computer, open the CreateCSVFiles.xls, run the program. I am able to run the program successfully after that even after I restart my SAS program.

But if I restart my computer, I need to go through the steps above again. Just wondering if anyone out there able to explain to me why this situation is happening?

art297
Opal | Level 21

A possibly simple explanation?  DDE is finicky, at best, and requires one to know an awful lot about their system's memory, interactions between processes, etc.  Paying for Access for pc products, at least on 32-bit machines, is well worth the cost, both in terms of productivity and lack of the kind of aggrevations you've had to face during this ordeal.

Reeza
Super User

Try the following code, a few slight modifications that could be the issue, ie you can say open instead of file-open and the close statement doesn't need a path if its the only file you're working with.

options noxwait noxsync;

x ' "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.exe" ';

data _null_;

x=sleep(5);

run;

filename ddecmd dde 'excel|system';

data _null_;

file ddecmd;

put '[OPEN("C:\My Projects\Temp\Data Capture\CreateCSVFiles.xls")]';

run;

data _null_;

file ddecmd;

put '[CLOSE()]';

put '[QUIT()]';

run;

Jomars
Calcite | Level 5

I also had this problem after my PC upgraded to windows 7!!!!!! Now I figured out what happened.

The following solution is by the assumption that we have exacly the same problem. thx.

Are you using google chrome browser? Close it while you are running dde program! I think they are conflicted.

Don't laugh. Trust me it is the reason for my computer.

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
  • 9 replies
  • 6548 views
  • 0 likes
  • 6 in conversation