BookmarkSubscribeRSS Feed
mnew
Calcite | Level 5
Experts:
Another beginner question. I'm writing the results of a proc freq and a proc print to a CSVAll file, as part of my learning exercise. Unlike the PDF, RTF destinations, I got two CSV files, instead of having both (proc freq and proc print) results in one CSV file. Did I do something wrong? If not, is there an option that we can use so the multiple proc step results can go to a single CSV file?
Thank you!

ods csvall file='Flight.csv';

proc freq data=sasuser.Europe;
tables dest*orig /crosslist;
run;
proc print data=sasuser.Europe;
id Dest;
var flight revenue;
run;
ods csvall close;
2 REPLIES 2
Ksharp
Super User
I am curious that I run your code and get only one csv file.
What release is your sas?
Or can use an option.


[pre]
ods csvall file='c:\Flight.csv' newfile=none;

proc freq data=sashelp.class;
tables sex*age /crosslist;
run;
proc print data=sashelp.class;
id name;
var sex age;
run;
ods csvall close;
[/pre]



Ksharp
mnew
Calcite | Level 5
Thanks! Your solution works great.
I have to apologize that I pasted in the wrong code yesterday. There were titles and footnotes in the code, which might be the reason.

Ods csvall file='Flight.csv';
Title 'Frequency by destination and origin';
Footnote 'Update needed';

Proc freq data=sasuser.Europe;
tables dest*orig /crosslist;
Run;

Title 'Details';
Footnote 'Listed by destination';

Proc print data=sasuser.Europe;
id Dest;
var flight revenue;
Run;
Ods csvall close;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 2633 views
  • 0 likes
  • 2 in conversation