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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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