BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
singhsahab
Lapis Lazuli | Level 10

Hi All,

 

Does it possible to export the sas dataset in .txt (text format) by using SAS ODS ?

 

Thank you in advance !!!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

ODS CSV will create a CSV file. 

ODS LISTING, the original SAS output can also be directed to a text file. 

A data _null_ step can create text files. 

 

Proc Export can create txt files as well. 

 

Note that you’ll lose graphs in a text file. 

View solution in original post

5 REPLIES 5
Reeza
Super User

ODS CSV will create a CSV file. 

ODS LISTING, the original SAS output can also be directed to a text file. 

A data _null_ step can create text files. 

 

Proc Export can create txt files as well. 

 

Note that you’ll lose graphs in a text file. 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Nope.  ODS is the destinations for output, it is not an output procedure in itself.  For that you would need to generate output, generally using output procedures such as proc report, print, tabulate, data step.  You can also select various objects from certain procedures, and proc sql without a create table automatically creates some output, but generally ods target set and then proc your data out to that destination.

ballardw
Super User

I don't really believe there is any actual "standard" TXT file format. Some "text" files use tab characters for delimiters, others don't. Some are fixed column.

So ODS would tend to have a bit of a moving target.

You may want to provide a short example of some example data and what you want your "text" file to look like so we can make specific suggestions.

singhsahab
Lapis Lazuli | Level 10

Hi Ballaardw

 

thank you for your post .However this can be achieve by ODS LISTING . Below mentation code works for me.

 

ODS NORESULTS;

ODS LISTING FILE "FILE.TXT";

PROC PRINT DATA=TEST;

RUN;

ODS LISTING CLOSE;

 

Thanks,

 

 

Rascon
Calcite | Level 5

ODS stands for output delivery system. It is mostly used to format the output data of a SAS program to nice reports which are good to look at and understand. That also helps sharing the output with other platforms and soft wares.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 1435 views
  • 2 likes
  • 5 in conversation