order .freq by count

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

order .freq by count

Postby CharlieEVIEWS » Sat Jan 16, 2016 4:34 am

Dear All,

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

Thanks!

Charlie

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: order .freq by count

Postby EViews Gareth » Sat Jan 16, 2016 1:52 pm

No :(

CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

Re: order .freq by count

Postby CharlieEVIEWS » Fri Feb 12, 2016 11:58 am

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

CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

Re: order .freq by count

Postby CharlieEVIEWS » Tue Feb 23, 2016 3:01 pm

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


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest