BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
BenoîtOry
Fluorite | Level 6

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) :

BenotOry_0-1664980523884.png

BenotOry_2-1664980811010.png

 

SAS 9.4 (calculated columns like Frequency has format) :

BenotOry_1-1664980638068.png

BenotOry_3-1664980911965.png

 

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 !

 

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

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. 

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

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


ballardw
Super User

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.

SASKiwi
PROC Star

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. 

BenoîtOry
Fluorite | Level 6

Thanks for all answers!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 604 views
  • 0 likes
  • 4 in conversation