Dear Statalist forum,
I am trying to figure out how to retrieve r-class (string) macros in a table or matrix (though I believe that Stata does not allow strings in matrices).
The specific problem poses with a community-contributed program entitled ‘fuzzy’ from SSC which conducts Qualitative Comparative Analysis. The r-class macro in question is called r(reducsols) which lists the reduced set of configurations of variables that are sufficient conditions of outcome y.
An example of the code for a simplified version of what I am running is as follows:
A data example is as follows:
My aim is for the r() results to appear in columns and the rows to represent the model runs. The final objective is simply to calculate frequencies of the different configurations in r(reducsols) across all model runs.
Many thanks in advance.
I am trying to figure out how to retrieve r-class (string) macros in a table or matrix (though I believe that Stata does not allow strings in matrices).
The specific problem poses with a community-contributed program entitled ‘fuzzy’ from SSC which conducts Qualitative Comparative Analysis. The r-class macro in question is called r(reducsols) which lists the reduced set of configurations of variables that are sufficient conditions of outcome y.
An example of the code for a simplified version of what I am running is as follows:
Code:
foreach ag in DIR_LAvag_ep1 DIR_LAvag_ep2 { foreach nrc in DIR_LAvnrc1 DIR_LAvnrc2 { foreach un in DIR_LAvunep1 DIR_LAvunep2 { foreach hx in DIR_LAvhxgdp1 DIR_LAvhxgdp2 { foreach cc in DIR_LAvcc1 DIR_LAvcc2 { foreach pv in DIR_LAvpv1 DIR_LAvpv2 { foreach gdp in DIR_LAvgdp1 DIR_LAvgdp2 { fuzzy DIR_eIGpt `ag' `nrc' `un' `hx' `cc' `pv' `gdp', label(E A N U H C P G) drop cluster(countrycode2) settest(yvv) sigonly greater (col1) reduce return list } } } } } } }
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long countrycode2 float(DIR_eIGpt DIR_LAvag_ep1 DIR_LAvnrc1 DIR_LAvunep1 DIR_LAvhxgdp1 DIR_LAvcc1 DIR_LAvpv1 DIR_LAvgdp1 DIR_LAvag_ep2 DIR_LAvnrc2 DIR_LAvunep2 DIR_LAvhxgdp2 DIR_LAvcc2 DIR_LAvpv2 DIR_LAvgdp2) 1 .9998251 .8579121 .9997882 .7823363 .11661627 .02323773 .56741875 .7343208 .8440647 .9998929 .7003923 .10530783 .026175546 .50763994 .7106618 3 .19934624 .6786882 .011351976 .9725192 .05396127 .50025994 .6642866 .4664742 .6325099 .02962735 .9760606 .05315039 .37887615 .6172676 .3793009 3 .06085407 .5604528 .002472623 .9710385 .09835684 .4457565 .7360237 .7771915 .4988 .01798621 .9744317 .09047104 .3367762 .7008132 .7586276 3 .3594101 .5653122 .5309777 .9995583 .12453914 .52044666 .8301989 .844972 .5034773 .22173548 .9998644 .11168496 .4075425 .811894 .8345274 5 .387501 .9989905 .0040096687 .00008248127 .1535487 .2276504 .023387434 .032034628 .9992915 .02107551 .0020224352 .13480234 .18011445 .02546238 .033655904 5 .2110556 .998571 .016540676 .00004868941 .3353772 .04033948 .05054407 .03250478 .9989647 .033512454 .0015545706 .27759176 .04143649 .05016291 .03408699 7 .1711162 .9960191 .003064675 .0006900888 .04937361 .8998212 .7091022 .04794051 .9968322 .01929836 .00582937 .04914059 .8903816 .6692826 .0478759 8 .12861241 .950956 .04945715 .034356616 .015572606 .02072834 .15898545 .0863899 .9508063 .048094 .04038786 .01778144 .023801103 .13887922 .0802676 8 .1847435 .8259943 .34100765 .08502126 .015229258 .04789184 .0497537 .12477698 .8063341 .09800395 .063685186 .017435826 .04781452 .04947099 .1111096 8 .19031915 .7638974 .4487884 .05598809 .014733804 .1583389 .06581113 .2135595 .7326642 .11219413 .0515391 .016935462 .13120243 .063315734 .18010275 9 .9961787 .29768136 .002472623 .9849795 . .9006351 .9419191 .58698845 .27274442 .01798621 .9887825 . .8913726 .9408779 .54831934 10 .08019128 .5663563 .9166325 .001549922 .52753866 .3814808 .3278866 .5701323 .5046363 .9106932 .008714626 .43483925 .2892033 .27101982 .5301206 10 .0793902 .3977356 .9622811 .0006900885 .675774 .6130423 .4050345 .6371341 .3629395 .9633512 .00582937 .5882706 .53559804 .3327227 .6029769 10 .29730946 .3477167 .8841813 .0007550285 .9196295 .4542588 .6051697 .7258599 .3176546 .8712117 .006096048 .9124197 .3432107 .5498409 .7012182 11 .08354057 .1803669 .50121576 .6811365 . . . .8744409 .1681514 .1223007 .54952455 . . . .8673537 11 .05797481 .14991052 .3164574 .8943532 .8658571 .9130123 .7302107 .9021435 .1409319 .0947731 .8721384 .8423233 .9063495 .6939902 .8979744 11 .06892747 .14722352 .6050046 .9380805 .8747861 .9098822 .7458922 .9191231 .13852443 .52614045 .9338567 .8542024 .9025797 .7124126 .916567 11 .1868905 .11966184 .6828637 .866134 .8878932 .9048929 .6885604 .9552838 .11374672 .619596 .8297703 .8715014 .8965453 .6453582 .9554403 12 .12979953 .9573952 .002472623 .013843493 .4346958 .9817634 .9638572 .7207978 .9578095 .01798621 .025755856 .3578402 .9838437 .9647185 .695573 12 .3299338 .9348686 .0036495586 .00052688544 .4638002 .9866836 .9837757 .8407758 .9329839 .02043557 .005096964 .3820327 .9886657 .9852605 .8298393 13 .010446037 .2326092 .6941381 .9998242 .7805845 .9869347 .9866411 .9426604 .2146944 .6334344 .9999571 .7272249 .9889064 .9880738 .9420126 13 .5827419 .24265434 .335379 .9994754 .9180566 .9836338 .9892424 .9731322 .22364126 .0972654 .9998319 .9104332 .9856992 .9905809 .9740347 15 .2305927 .15231666 .8017349 .44620895 . . . .9071078 .14308673 .7679586 .16686647 . . . .9034268 15 .44808555 .12229127 .6984933 .9235589 .50829065 .9937497 .9509165 .9716776 .11611824 .6387978 .9140911 .4193047 .9951671 .9507676 .9725415 15 .3089917 .09921297 .9831311 .9293272 .6658258 .9936525 .937879 .994944 .09523124 .9852031 .9220477 .5754836 .9950823 .9363952 .9955834 16 .24497074 .9260473 .6921626 .0009481966 . . . .07496368 .9230513 .6310049 .006827132 . . . .07084865 16 .20051724 .8527917 .5608154 .006368514 .03733589 .8176467 .6673003 .19308197 .8380291 .3697783 .01754992 .03840642 .7880222 .6207436 .16433184 16 .2027896 .7707778 .633033 .14804713 .069051065 .6311538 .4921599 .5357814 .7408186 .5593211 .08509903 .06609651 .5570791 .4049764 .4860035 17 .9999931 .8849078 .028967 .24122047 . .835052 .8227899 .3550775 .8757141 .04028201 .11174891 . .8099363 .8031552 .2896273 17 .884125 .8527655 .6573328 .55798787 .024547355 .08183897 .02872823 .28025186 .8379983 .58852214 .28546757 .02654456 .0748908 .030509435 .2314199 17 .5060262 .7922843 .7892691 .6274149 .03397624 .19526803 .07178957 .2870156 .7663343 .7522393 .4508732 .035344046 .15736952 .06837282 .2366413 18 .940098 .9687806 .7382533 .5807858 .0273262 .06246279 .57862633 .1662027 .9699548 .6881583 .3351463 .02917356 .0597017 .52009255 .14354117 18 .0784303 .9133025 .8266576 .01878535 .016262518 .07844792 .4252648 .19216953 .9085431 .7993741 .02994887 .018473156 .072273366 .34921685 .16362806 19 .3761744 .9867235 .8745244 .00939097 .009776367 .018262668 .024047654 .03226896 .9881948 .8592731 .021263184 .011801998 .02142071 .026093194 .033870865 20 .09775539 .58515173 .9999998 .9992882 .02430561 .05781099 .3242459 .49328315 .5256026 .9999999 .9997537 .02631424 .05595807 .26814586 .4016703 21 1 .2323775 .6466626 .9634154 . .628721 .04087318 .8137519 .21448804 .5756525 .9657286 . .55418026 .04160533 .7995969 21 .12937467 .16608436 .8422685 .9706991 .9937236 .7973086 .04852753 .9183831 .15540047 .8190027 .9740553 .9955429 .7623762 .04839512 .9157603 21 .04824586 .1426942 .7373155 .9018189 .996276 .7699111 .0995608 .9561101 .13446346 .6869869 .8830876 .997578 .7278587 .09136338 .9563125 24 .2256738 .15875778 .002515915 .11660291 . . . .8682277 .14885081 .01808894 .0749865 . . . .86045 24 .4311629 .15255158 .002651252 .5962827 . .9817777 .9746339 .9081886 .14329706 .018402595 .3716838 . .983858 .9760111 .9046122 24 .23738016 .13512745 .002499571 .6533053 .980954 .9777166 .9709578 .9390358 .12767053 .018050302 .5104984 .9836752 .9797482 .9721991 .938125 24 .488186 .09130382 .002726541 .9160923 .9986492 .9727237 .9518052 .9854144 .08802892 .018572422 .9036104 .9992589 .9745644 .9517369 .9864166 26 .23227173 .11183016 .50119853 .5785442 .16413684 .3725552 .7185971 .9028055 .10667153 .1222563 .3300409 .14317036 .28272638 .6803823 .8987023 26 .21087545 .09838736 .063975655 .7007349 .5261584 .218339 .8402543 .9485477 .0944806 .0524321 .5777393 .43371895 .17358427 .8237404 .9482982 28 .08682521 .3645156 .9659503 .44917625 .08408125 .29572412 .28913605 .7811438 .3328139 .9673417 .1677023 .07870112 .22790436 .24055608 .763056 28 .08646757 .3289162 .9882327 .03023658 .6147999 .3028594 .28432205 .8648812 .3007411 .9901406 .03790611 .5113621 .23294047 .2367881 .8567271 28 .04547818 .2986325 .9377541 .014949712 .9744344 .4997293 .6828803 .9124943 .27359533 .9356223 .026752764 .9769636 .3782997 .6387665 .9093281 29 .7277751 .51212263 .956488 .9586241 . . . .6186623 .465512 .9569549 .9600171 . . . .58275783 29 .02555997 .326193 .9514986 .984271 .08684949 .50934446 .06028131 .8652772 .29829535 .9513625 .9881147 .08099722 .39167956 .05859467 .8571678 30 .18614653 .9940083 .00437525 .005641208 .1976793 .5048323 .13514587 .029660573 .9950496 .021686597 .016528541 .16952516 .38529995 .12000613 .031466827 30 .3368868 .9934592 .005810529 .0003543044 .04662901 .43083945 .04169093 .03861104 .994552 .0237976 .0041831457 .04672209 .3255736 .04233724 .03962035 30 .27513126 .9878085 .02475335 .00026119032 .029059326 .6180102 .04621218 .05837571 .9892447 .03825127 .003593603 .030797133 .54146695 .04635511 .05688706 31 .11476108 .3227723 .027727526 .036438864 .3707477 .8985887 .848554 .8742544 .29522458 .03970602 .04158664 .3058241 .8888794 .8335023 .8671467 31 .2030878 .253549 .4230216 .12052163 .24782024 .8264717 .6931003 .8775847 .23334835 .10876093 .0762975 .20873085 .7991401 .6506344 .8708426 34 .04162662 .9269835 .6214322 .6626219 . .7946273 .6621299 .12269536 .92411 .54551995 .52342033 . .758995 .6147822 .10946125 34 .09544399 .9156401 .619681 .870963 .03396461 .8202729 .7314411 .1568286 .9112164 .5434449 .8371093 .03533339 .7913319 .6954339 .1362532 34 .1583759 .86975 .7992728 .5241954 .2214308 .9051107 .7939234 .27802128 .8579828 .7648534 .22134297 .18810578 .8968093 .769065 .22969915 35 .073107265 .9806591 .8732589 .12652935 .010533265 .04721186 .030385725 .0753463 .9821928 .8577036 .07827634 .01260294 .04724718 .03205211 .07116639 38 .9806584 .50463533 .166614 .001650542 .25392935 .477426 .26742026 .6474922 .46040455 .07333149 .008990997 .21350776 .36093915 .2235802 .6143549 38 .5262823 .427531 .5131345 .0034617945 .26897055 .5232615 .26741827 .7045932 .3901508 .1564741 .01298039 .22527897 .4116006 .2235786 .6775287 39 .04976773 .3672153 .9851026 .9850503 . .8688331 .6524152 .6594344 .3352545 .9871376 .9888489 . .8522069 .6036091 .6275067 40 .12378021 .5510712 .003163408 .00941492 . . . .3177647 .4922863 .019500047 .021289954 . . . .26046455 40 .82735 .507312 .003698132 .3850896 .5016611 .16996717 .5505832 .3918921 .46222925 .02052431 .15007663 .4139963 .13948162 .4852424 .3187668 40 .0014227626 .4810545 .02961482 .010110683 .8773099 .18867947 .4731031 .50529724 .4395683 .04057666 .02205314 .8575471 .1527248 .388882 .4187632 40 .6063197 .4294734 .008942577 .56296396 .8424221 .25060558 .53848803 .5268753 .3919316 .02740303 .2958789 .8108825 .1962029 .4673829 .4661571 42 .9986849 .7789831 .7566686 .09796886 . .23474108 .10109074 .5893991 .7505496 .7112193 .06849763 . .1850846 .09261061 .55092955 42 .09975518 .6729922 .8795261 .8062148 .03108327 .3328224 .09749778 .6998408 .6258926 .8654652 .7373034 .03267887 .2541945 .08967882 .6722453 43 .3482103 .9521151 .5182519 .6106392 .02529511 .7361481 .11050633 .12063693 .9520732 .1733942 .4073334 .0272553 .685529 .10025097 .10782901 43 .25510073 .9072071 .6375297 .57590866 .025895827 .7453616 .10904261 .26348257 .9015481 .5646955 .3240986 .027824474 .6970477 .09906702 .218496 44 .19453003 .2559963 .9992501 .9543986 . .6538942 .6225269 .824612 .23552956 .999556 .9548442 . .58436686 .5694787 .8117587 44 .13654691 .206112 .9998828 .9840348 .28695875 .4018747 .0965764 .9425777 .1910978 .999945 .9878902 .23938403 .3041107 .08892541 .941924 45 .4452345 .246923 .9999999 .8852993 .3839523 .026125696 .0230752 .7937378 .2274441 .9999999 .8586959 .3164525 .02885608 .025163304 .7771697 47 .08553947 .2767326 .8143232 .9985367 . . . .8227617 .25402543 .7838328 .9993934 . . . .8096873 47 .4351964 .20646553 .55957234 .9983528 .6024202 .9270939 .8492582 .8290179 .19141266 .3627516 .9992965 .4973211 .9231364 .8343298 .81669 48 1.391801e-08 .05493563 .003198876 .9992154 . .8923233 .7962229 .7608361 .05447786 .01957146 .9997218 . .8812197 .7717815 .7403104 50 .05414808 .3854773 .9997039 .7962793 .3598762 .13101365 .9355268 .9908762 .3517986 .999844 .7219189 .29711172 .11153447 .9337747 .991741 51 .3146939 .9516885 .0031940616 .001388444 .15351115 .1148937 .07679686 .22634156 .9516072 .0195618 .008251364 .13477263 .09974177 .0725748 .18993236 52 .009016321 .5136841 .6232916 .8751847 .8063771 .035145435 .14733092 .28622463 .4665785 .5477257 .8434995 .7621335 .03693958 .12967648 .2360304 52 .40661725 .4018367 .8625531 .889023 .9218137 .04191217 .176029 .3976283 .3666735 .8443873 .8642445 .9151697 .04277924 .15227334 .323346 55 .9966942 .9980261 .002472623 .0006345244 . .4443388 .9166693 .0995741 .9985271 .01798621 .005590948 . .3357069 .9125205 .0909806 55 .10750972 .99705 .002472623 .00015406223 .0667715 .3867867 .54793805 .14720343 .9977162 .01798621 .002762095 .06416174 .29306686 .4813251 .12874317 55 .21488322 .994991 .6551015 .000025015255 .03177695 .036302567 .5273974 .2365531 .9959291 .5858251 .001114761 .033320464 .0379502 .4511374 .1977825 55 .08344603 .9898693 .9291963 3.516645e-06 .019461866 .036492098 .7034419 .4530184 .9912144 .9256154 .00041825545 .02163753 .03811523 .6626774 .3682057 59 .10264227 .5236542 .002551245 .7760423 .23090126 .8372994 .11095332 .6945974 .4734001 .018171903 .6907093 .19550733 .8127614 .10061228 .6664208 59 .23887786 .3739157 .002570422 .10574128 .12073804 .7954388 .46814775 .8782703 .3413175 .018216604 .07125959 .1086295 .7600183 .384726 .8716031 61 .9998758 .7911064 .005208078 .9949507 . .8738552 .6904417 .3330384 .7649361 .02296 .9971406 . .8584433 .6475439 .27236325 61 .1130863 .7464546 .019473294 .9769777 .07133704 .8125427 .5592293 .51992977 .7120226 .03535403 .980829 .06803011 .781588 .4980882 .4507771 61 .1755819 .6390516 .696996 .9249986 .3812578 .7695017 .5079321 .6231587 .5867278 .6369529 .916089 .3142794 .7273437 .4229797 .58767074 62 .9946911 .9951331 .0024882345 .03466761 .2763385 .8487343 .7618228 .0593544 .9960551 .018023394 .04056911 .2310521 .827112 .7311733 .0577221 64 .9996303 .19489923 .6528819 .25540313 . .6228805 .22257572 .9748879 .1811082 .5831451 .11557686 . .5472379 .18862543 .9758305 64 .04599826 .15802057 .629343 .0025604726 .2994132 .8220571 .6734463 .9853518 .1481914 .5549211 .011178738 .24917376 .7935799 .6278428 .9863548 64 3.0843955e-06 .12238888 .8068217 .04586949 .4898676 .8212793 .4086491 .9883026 .11620624 .7743739 .04664151 .4040285 .7926 .3356586 .989251 67 .3741288 .3948864 .9784541 .3917411 .3652713 .5681746 .9514636 .837355 .3603473 .9805021 .1518712 .3014312 .4780994 .9513645 .8260155 68 .57454455 .9970089 .002506361 .0013938566 .09216986 .6861615 .8032665 .027011445 .9976814 .018066375 .0082673235 .08539095 .6236369 .7801024 .02899811 68 .363982 .9954597 .5453243 .002328964 .08367497 .5930102 .8720326 .03284762 .9963432 .28715914 .010665695 .07836353 .51211673 .8610063 .03440086 68 .27512652 .9929559 .7123315 .005987952 .0891206 .6541901 .8962056 .03945197 .9940926 .6559001 .017023345 .0828758 .5847242 .889069 .04037361 69 .03014102 .6005257 .9406983 .9491047 .034220915 .7064064 .8060006 .4490146 .54289144 .939031 .9482006 .035568215 .6485663 .783332 .36492035 69 .0003240467 .4903043 .9989377 .9475987 .04974325 .3607727 .15474205 .5046364 .4481867 .9993429 .9462798 .04946514 .2742168 .1355332 .4173322 70 .4728313 .07775325 .002472623 .8265254 .13220136 .9701675 .9724965 .9789435 .07562216 .01798621 .7687915 .11782333 .9718623 .9738002 .9799489 70 .4292493 .06774736 .002472623 .7986053 .3298305 .947925 .9820712 .9924564 .06639519 .01798621 .725518 .27319214 .9473144 .9835652 .9932494 end label values countrycode2 countrycode2 label def countrycode2 1 "AGO", modify label def countrycode2 3 "ARM", modify label def countrycode2 5 "BDI", modify label def countrycode2 7 "BFA", modify label def countrycode2 8 "BGD", modify label def countrycode2 9 "BLZ", modify label def countrycode2 10 "BOL", modify label def countrycode2 11 "BRA", modify label def countrycode2 12 "BTN", modify label def countrycode2 13 "BWA", modify label def countrycode2 15 "CHL", modify label def countrycode2 16 "CHN", modify label def countrycode2 17 "CIV", modify label def countrycode2 18 "CMR", modify label def countrycode2 19 "COD", modify label def countrycode2 20 "COG", modify label def countrycode2 21 "COL", modify label def countrycode2 24 "CRI", modify label def countrycode2 26 "DOM", modify label def countrycode2 28 "ECU", modify label def countrycode2 29 "EGY", modify label def countrycode2 30 "ETH", modify label def countrycode2 31 "FJI", modify label def countrycode2 34 "GHA", modify label def countrycode2 35 "GIN", modify label def countrycode2 38 "GTM", modify label def countrycode2 39 "GUY", modify label def countrycode2 40 "HND", modify label def countrycode2 42 "IDN", modify label def countrycode2 43 "IND", modify label def countrycode2 44 "IRN", modify label def countrycode2 45 "IRQ", modify label def countrycode2 47 "JAM", modify label def countrycode2 48 "JOR", modify label def countrycode2 50 "KAZ", modify label def countrycode2 51 "KEN", modify label def countrycode2 52 "KGZ", modify label def countrycode2 55 "LAO", modify label def countrycode2 59 "LKA", modify label def countrycode2 61 "MAR", modify label def countrycode2 62 "MDG", modify label def countrycode2 64 "MEX", modify label def countrycode2 67 "MNG", modify label def countrycode2 68 "MOZ", modify label def countrycode2 69 "MRT", modify label def countrycode2 70 "MUS", modify
Many thanks in advance.
Comment