Hello,
We are still using SAS 9.2 (through SEG) and we are starting to work with SAS 9.4 (through SAS Studio).
We noticed a difference when using proc freq procedure :
SAS 9.2 (calculated columns like Frequency has no format) :
SAS 9.4 (calculated columns like Frequency has format) :
Here is the procedure used :
ods output CrossTabFreqs(match_all=hold)=_tab_freq;
proc freq data=sashelp.class;
tables sex*age / missing;
run;
The consequence is that our SAS Unit tests no longer work properly, they contain a proc compare between tables which fail, come out in error.
Is there a way to have exactly same SAS 9.2 behavior on SAS 9.4 ?
We found a workaround but we'd like to avoid it (many programs might be impacted) :
proc datasets lib=work memtype=data;
modify _tab_freq;
attrib percent frequency format=;
contents data=work._tab_freq;
run;
quit;
Thanks in advance for any idea !
ODS applies formatting as well as data output and has evolved considerably since SAS 9.2. If all you require is the data then @Tom 's suggestion is the better option. For now your workaround looks like the easiest solution.
Why not just use the normal OUT= dataset instead?
That does not attach a format to the COUNT.
proc freq data=sashelp.class;
tables sex*age / missing out=freq ;
run;
Variables in Creation Order # Variable Type Len Label 1 Sex Char 1 2 Age Num 8 3 COUNT Num 8 Frequency Count 4 PERCENT Num 8 Percent of Total Frequency
If your output for the Proc freq example using SASHELP.CLASS shows a format of BEST7. then likely there is some other setting your organization has used as I get frequency to have a BEST12. format result with SAS 9.4 M4.
That PICTURE you show appears to be from SAS Enterprise Guide. Which version?
SAS data sets always have a format. In some reports it might not show when it is a default but that depends on a number of factors.
Depending if the only concern is the Proc Freq Crosstabfreqs or ONEwayfreqs out you could use a modified template that creates the output. The Templates are in SASHELP.Templbase >Base>Freq . You do not want to replace that template but create a copy for use. If you are going to go this approach be careful and follow the example in the Proc Template documentation. Look for "Example 1: Editing a Table Template That a SAS Procedure Uses" as there is a LOT of Proc Template to wade through.
Perhaps show the CODE of the Proc Compare you are using. It sounds like your code is using the ERROR option. Perhaps you could change that to WARNING instead. Without knowing exactly what you are concerned with in your compare I can't make much more of a suggestion.
ODS applies formatting as well as data output and has evolved considerably since SAS 9.2. If all you require is the data then @Tom 's suggestion is the better option. For now your workaround looks like the easiest solution.
Thanks for all answers!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.