DATA Step, Macro, Functions and more

Proc export to csv problem

Reply
Occasional Contributor
Posts: 5

Proc export to csv problem

Hello everyone,

I am trying to export sas output to external csv file.

I am using the following lines:

proc export data=work.abcd_&today.

outfile="D:\ABCD\abcd_&today..csv"

dbms=csv;

run;

The log says:

NOTE: "D:\ABCD\abcd_20160415.csv" file was successfully created.

But there is no file generated in the predefined path.

What could be the problem and am I missing something?

Thanks in advance!

Super User
Super User
Posts: 7,401

Re: Proc export to csv problem

What software are you running, is it SAS Universtiy Edition, Enterprise Guide etc.  Do you have write access to D:?  Does the drive mapped to D: within SAS reflect the D: drive you are looking at?  Are you on a mainframe?  Does the datset - which is used in the proc:

work.abcd_&today.

contain any observations?  I don't know what that macro variable resolves as.

Occasional Contributor
Posts: 5

Re: Proc export to csv problem

Thanks for the fast reply.

It is Enterprise Guide 4.3.I have a write access to D.The macro variable is returning the sysdate in yyyymmdd format.

The table has observations in it. I am using corporate computer.

About the mapping between D:\s I am not sure and I do not know how to check it...

Actually when I am exporting the table with the Export wizard, as a step in the process flow, everything works perfect.

Super User
Super User
Posts: 7,401

Re: Proc export to csv problem

Can you try it without the macro variables:

proc export data=work.abcd_20160415 outfile="D:\ABCD\abcd_20160415.csv" dbms=csv;

run;

 

It shouldn't make any difference, but if its working through menu export options I don;t see why it wouldn't.  Have you tried - I think its the last option on the export wizard - to save the code generated by the export wizard - you have two buttons to the lower right, one is finish the other is next and you can save the code.  Copy that code and run it in your project.

Occasional Contributor
Posts: 5

Re: Proc export to csv problem

I have replaced the macro vars with their outcome and it did not work.
Also, I can not find anything that looks like sas code in the export wizard...the only thing is "Export job Export successful to: D:\ABCD\abcd_20160415.csv" in the log of the export.
:\
Trusted Advisor
Posts: 2,113

Re: Proc export to csv problem

[ Edited ]

Dzhu,

 

Is the SAS server a remote server or a local (on your desktop).  If remote, the D: drive there may be different from the one that you can see with Windows Explorer.

 

The export wizard operates within EGuide, but the PROCs excute within the server.

Occasional Contributor
Posts: 5

Re: Proc export to csv problem

It is a remote server.
How can I predefine the drive so I can use the one on my machine?
Trusted Advisor
Posts: 2,113

Re: Proc export to csv problem

You probably can't.  Typically, corporate servers are set up to see shared network drives, but not drives on desktops or laptops.  Your IT support group may be able to configure it for you if you can make a sufficient business case to them.

Occasional Contributor
Posts: 5

Re: Proc export to csv problem

Thanks for the reply.

I will try to be as convincing as possible Smiley Happy

Hope it will work.

Ask a Question
Discussion stats
  • 8 replies
  • 450 views
  • 0 likes
  • 3 in conversation