Hello,
I am new to using SAS and am having trouble creating a two-way frequency table. I've done some web searches and I believe I am using the correct code, but apparently not. Would appreciate some help!
proc freq data=work.import1;
order=frequency;
table jurisdiction*reportablecondition;
run;
Thank you!
You do not want a semi-colon after
proc freq data=work.import1
Please post logs in the future by simply copy/pasting them into a window opened with the {i} button.
ORDER is not a valid statement in proc freq; I guess you wanted to use either BY or WEIGHT.
See the documentation of PROC FREQ.
@Kurt_Bremser wrote:
ORDER is not a valid statement in proc freq;
Actually, it is a valid option
You have an extra semi-colon in the middle of your PROC FREQ statement.
To help avoid this type of mistake when typing a statement that is too long to fit legibly on one line (more than about 75 characters) I always place the semi-colon that ends the statement on a new line. The same as I would place the END statement that ends a multiple statement block of code.
proc freq data=work.import1
order=frequency
;
table jurisdiction*reportablecondition;
run;
ORDER= is an option on the PROC FREQ statement, not a statement on its own. So it needs to be before the semi colon.
Also, the valid values for ORDER are DATA, FORMATTED, FREQ or INTERNAL. I suspect SAS may correct frequency to FREQ but you may get a warning about that.
proc freq data=work.import1 order = freq;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.