Page 1 of 1

order .freq by count

Posted: Sat Jan 16, 2016 4:34 am
by CharlieEVIEWS
Dear All,

Is it possible to order the series.freq (one way tabulation) by count rather than alphabetically by alpha name?

Thanks!

Charlie

Re: order .freq by count

Posted: Sat Jan 16, 2016 1:52 pm
by EViews Gareth
No :(

Re: order .freq by count

Posted: Fri Feb 12, 2016 11:58 am
by CharlieEVIEWS
now it is possible:

Code: Select all

subroutine frequencytab(alpha inputalpha) freeze(inputalpha_tab) inputalpha.freq(nocum,nolimit) !numberunique=@rows(@uniquevals(inputalpha)) wfcreate(wf=frequencytabulated) u !numberunique copy alldatasets::inputalpha_tab frequencytabulated::inputalpha_tab alpha uniquevalues = "" genr uniquevaluefreq = NA for !y = 1 to !numberunique uniquevalues(!y) = inputalpha_tab(7+!y,1) uniquevaluefreq(!y) =@val(inputalpha_tab(7+!y,2)) next group tabber uniquevaluefreq uniquevalues tabber.sort(-1) freeze(freqtab) tabber copy frequencytabulated::freqtab alldatasets::freqtab freqtab.deletecol(a) 1 wfclose frequencytabulated d inputalpha_tab endsub

Re: order .freq by count

Posted: Tue Feb 23, 2016 3:01 pm
by CharlieEVIEWS
Better to endogenously pull out the wf name - cleaner:

Code: Select all

subroutine frequencytab(alpha inputalpha) %wfnameholder = @wfname freeze(inputalpha_tab) inputalpha.freq(nocum,nolimit) !numberunique=@rows(@uniquevals(inputalpha)) wfcreate(wf=frequencytabulated) u !numberunique copy {%wfnameholder}::inputalpha_tab frequencytabulated::inputalpha_tab alpha uniquevalues = "" genr uniquevaluefreq = NA for !y = 1 to !numberunique uniquevalues(!y) = inputalpha_tab(7+!y,1) uniquevaluefreq(!y) =@val(inputalpha_tab(7+!y,2)) next group tabber uniquevaluefreq uniquevalues tabber.sort(-1) freeze(freqtab) tabber copy frequencytabulated::freqtab {%wfnameholder}::freqtab wfclose frequencytabulated d inputalpha_tab endsub