DATA Step, Macro, Functions and more

Copying a SAS table to Excel

Reply
Occasional Contributor lg2
Occasional Contributor
Posts: 6

Copying a SAS table to Excel

[ Edited ]

/* Create dim table report for google sheet */
proc sql;
create table DXCLASS as
select
* put(..xyz)
from
xyz
where
DIAGNOSIS_ID 
;
quit;

 

I have created a dimension table and i have got the results in a table .I want to copy the table to an excel.How to copy my results of the table from sas to an excel,

 

Edit: via @Reeza - to modify the subject line to be more descriptive.

Super User
Posts: 23,323

Re: coying a table

[ Edited ]

The term for this is exporting data. 

 

You can use PROC EXPORT or a LIBNAME statement. This was asked recently here:

https://communities.sas.com/t5/Base-SAS-Programming/How-to-Export-sas7bdat-file-into-excel/m-p/46771...

 


@lg2 wrote:

/* Create dim table report for google sheet */
proc sql;
create table DXCLASS as
select
* put(..xyz)
from
xyz
where
DIAGNOSIS_ID 
;
quit;

 

I have created a dimension table and i have got the results in a table .I want to copy the table to an excel.How to copy my results of the table from sas to an excel,


 

Valued Guide
Posts: 560

Re: Copying a SAS table to Excel

Additionally, In case if your are using SAS Enterprise Guide then you can send your data to excel without any coding required. 

 

image.png

Thanks,
Suryakiran
Super User
Posts: 23,323

Re: Copying a SAS table to Excel

Posted in reply to SuryaKiran

@SuryaKiran EG, SAS Studio, and Base all have that option, but it’s not saved in your code or as a step in your process so I usually never recommend it, or use it. Having the file path to knowing where the output is and no manual steps is the easiest solution. 

Regular Contributor
Posts: 202

Re: Copying a SAS table to Excel

In recent version of Enterprise Guide, you can change the default output-format of a program to Excel an use any outputting procedure to create an excel-file (that has to be saved manually). If you need the export always, using proc export or ods excel is recommended.
Ask a Question
Discussion stats
  • 4 replies
  • 105 views
  • 0 likes
  • 4 in conversation