BookmarkSubscribeRSS Feed
eashcra1
Calcite | Level 5

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;

Screen Shot 2019-10-11 at 12.35.22 PM.png

 

Thank you!

5 REPLIES 5
PaigeMiller
Diamond | Level 26

You do not want a semi-colon after

 

proc freq data=work.import1

 

--
Paige Miller
Kurt_Bremser
Super User

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.

PaigeMiller
Diamond | Level 26

@Kurt_Bremser wrote:

 

ORDER is not a valid statement in proc freq;


Actually, it is a valid option

 

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=statug&docsetTarget=statu...

--
Paige Miller
Tom
Super User Tom
Super User

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;

 

Reeza
Super User

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;

 

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.3&docsetId=procstat&docsetTarget=pro...

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 1658 views
  • 2 likes
  • 5 in conversation