Dear All: My code is proc freq data = have ; table X*y / norow nocol ; weight V ; run; Can I output the table to CSV (preferable) or RTF format. Also how can I output the results to a SAS data set? Randy
SAS dataset - use OUT = on the TABLE statement.
RTF is possible easily.
Ods rtf body = ‘c:\....\output.rtf’ style = meadow;
Proc freq data = have;
Table x*y / norow nocol OUT=outDataSet;
Weight V;
Run;
Odd rtf close;
Style controls how the output appears.
https://documentation.sas.com/?docsetId=odsadvug&docsetTarget=p14qidvs5xf7omn14ommvsuhvmzn.htm&docse...
@RandyStan wrote:
Dear All: My code is proc freq data = have ; table X*y / norow nocol ; weight V ; run; Can I output the table to CSV (preferable) or RTF format. Also how can I output the results to a SAS data set? Randy
You can send proc output directly to a CSV file using ODS CSVALL such as:
ods csvall file="x:\data\freq.csv"; proc freq data=sashelp.class; tables height*weight/norow nocol; weight age; run; ods csvall close;
However you may get to spend some time working with system options and such to get "pretty" or desired output as CSV is text and things like the procedure title and auxiliary information like the proc freq cell layout information may not be very pretty as created. And it gets worse for many other procedures.
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.
Ready to level-up your skills? Choose your own adventure.