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;
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 3269 views
  • 0 likes
  • 2 in conversation