BookmarkSubscribeRSS Feed
4 REPLIES 4
Tom
Super User Tom
Super User

How about a CSV file?

data _null_;
  set have;
  file "filename.csv" dsd ;
  put (_all_) (+0);
run;

With a little more work you can add a header row that shows the names of the variables also.

ballardw
Super User

With a couple of ways to create CSV mentioned it may be time to ask "what flavor of text file?" Other than CSV (comman separated values) there are other characters used to separate each value. Common choices are tab and pipe (|) characters, less frequently colons or semicolons. Sometimes multiple characters.

Or maybe fixed width where each column (variable) has text start in the some character position.

Or maybe something less common like Named output where you indicate a variable name followed by an = and the value, which would include quotes when there are spaces: somevar="This a named value"

Or perhaps other specific text file formats like JSON, XML or similar.

Or even a report layout?

 

SASKiwi
PROC Star

What's the reason for converting to a text file? If we knew what you are planning to use them for we can offer more informed advice.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 968 views
  • 1 like
  • 5 in conversation