LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (May 1996, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 4 May 1996 08:18:24 -0700
Reply-To:     Karsten Self <kmself@IX.NETCOM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Karsten Self <kmself@IX.NETCOM.COM>
Subject:      Re: PROC FREQ limitation -Reply
Comments: To: Walter Scott <wscott@MAIL.STATE.TN.US>

As Walter wrote, this is one of several limitations to proc freq, the other being that character values are truncated to length 16 in proc freq tabulations. For character vars longer than 16, FREQ returns the number of unique values based only on the first 16 characters of the value.

Both of these issues may be overcome through SQL. The printed report is not the same, but equivalent output datasets may be generated if you are simply interested in frequency, percent, or cumulative values of either. Code below generates a dataset with the value and frequency count in both sql and freq. Output is identical for variables with less than 32,767 values, or length <= 16. Performance in my experience is roughly comperable.

(adapted from working code but untested)

proc freq data= mydata; tables myvar /out= freqout; run;

proc sql noprint; create table sqlout as select myvar as myvar, count( * ) as count from mydata group by myvar ; quit;

You can run a data step on the sqlout to generate the appropriate additional PROC FREQ statistics if you desire.

At 03:16 PM 5/3/96 -0500, Walter Scott wrote: > "The maximum number of levels allowed for any one variable is >32,767." SAS Procedures Guide, Version 6, Third Edition p#337. > >Walter Scott > >Original Question>>>>>>>>>>>> >>>> abdu elnagheeb <Abdelmoneim.H.Elnagheeb@aexp.com> 08:48 Fri, >3 May 96 >>> >I have noticed that if there are too many UNIQUE values for a variable on >which you run PROC FREQ, you will get an error from SAS. I did this on >a BIG data set and the error reads: > >ERROR: There are more than 32767 levels for variable ACCT9. > > The program was : PROC FREQ data=dataname noprint; > Tables acct9 /out =xcount; > proc sort data=dataname out=newname; > by acct9; > data temp; > merge newname xcount; by acct9; run; > >I wanted to use the data set xcount to create a new variable (count) that >shows the freq of acct9 in each observation. I got other codes from >good SAS-Lers to do this. But I wonder if this can be fixed. >Anyone familiar with this limition and how to overcome. >Thanks in advance (TIA.) > >Abdu > > ---------------------------------------- Karsten Self / kmself@ix.netcom.com

What part of gestalt don't you understand?


Back to: Top of message | Previous page | Main SAS-L page