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