DATA Step, Macro, Functions and more

Problem in SAVING csv file using Data _NULL_

Reply
Frequent Contributor
Posts: 127

Problem in SAVING csv file using Data _NULL_

I am trying to save the .csv file  with the same name using following data _NULL_.  But my system hangs up when I use the following statements.  I am using SAS 9.2    Can anybody help me in finding a solution?

 

 


filename exl dde 'excel|system';
options noxwait noxsync;
x "'C:\Program Files\Microsoft Office\Office15\EXCEL.EXE' C:\Temp\test.csv";
data _NULL_;
x=sleep(5);
run;
data _null_;
file exl;
put '[SAVE()]';
put '[CLOSE()]';
run;
data _null_;
file exl;
put '[QUIT()]';
run;

Super User
Super User
Posts: 7,074

Re: Problem in SAVING csv file using Data _NULL_

What are you actually trying to do?

And why are you trying to use DDE?  DDE is not really supported and there are lots of known issues with it.

Frequent Contributor
Posts: 127

Re: Problem in SAVING csv file using Data _NULL_

I am trying to save .csv file to read it back into SAS using PROC IMPORT.  The reason I am doing this is that it gives me INVALID string error if I try to read the file directly using PROC IMPORT.  If I save the file and then use PROC IMPORT, I don't get that error.

 

Is there any other way I can save the file.  Please let me know.

 

Thanks

Super User
Posts: 7,832

Re: Problem in SAVING csv file using Data _NULL_

Post the log from the failed import step.

Also post the test.csv, so we can play around with it to see what causes the invalid string error.

Most probably you have an encoding difference between the file and SAS; if you have SAS DBCS installed, you can use the encoding= option for the infile.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,074

Re: Problem in SAVING csv file using Data _NULL_

[ Edited ]

What ENCODING is your SAS session using?  What ENCODING is the CSV file using?

If the CSV file does not include encoding information in it then you can tell SAS what encoding to use.

filename myfile 'myfile.csv' encoding=utf8 ;
proc import datafile=myfile ....

 

Super User
Posts: 19,851

Re: Problem in SAVING csv file using Data _NULL_

This code won't do anything. It should open the csv file, then close and quit but there's nothing actually done in the code. 

 

What is your definition of 'hanging'? Most likely it's waiting for instructions once you hit Save. Click over to Excel and see what's happening.

Super User
Posts: 11,343

Re: Problem in SAVING csv file using Data _NULL_

There are several programs out there that if they are running they interfere with DDE. My person experience is with Cisco Jabber. If the SERVICE (not the program but the Service reported by Task Manger) is running then whatever it does to interfere with DDE means that none of the DDE statements are able to execute.

 

 

Ask a Question
Discussion stats
  • 6 replies
  • 124 views
  • 1 like
  • 5 in conversation