Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exporting pca results to Excel

    Hello,

    I am trying to export the results of my pca from Stata to Excel. I have tried following Clyde's code from a previous post (https://www.statalist.org/forums/for...actor-analysis) but the excel sheet it produces is just filled with rows of "1", no variables, loadings etc.

    This is my code:
    Code:
    global X BreadCereals Meat FishSeafood MilkCheeseEggs OilsFats Fruit Vegetables SugarJamHoneyChocolate FoodProductsNEC CoffeeTeaCocoa MineralWatersSoftDrinksF Spirits Wine Beer Tobacco ClothingMaterials Garments OtherArticlesofClothingClo CleaningRepairHireofCloth Footwear ActualRentalsforHousing MaterialsforTheMaintenance ServicesforTheMaintenanceR WaterSupply RefuseCollection SewerageCollection OtherServicesRelatingtoTheD Electricity Gas LiquidFuels SolidFuels HeatEnergy FurnitureFurnishings CarpetsOtherFloorCoverings FurnishingsFloorCoverings HouseholdTextiles MajorHouseholdAppliancesWheth RepairofHouseholdAppliances GlasswareTablewareHousehold ToolsEquipmentforHouseGa NonDurableHouseholdGoods DomesticServicesHouseholdSe PharmaceuticalProducts OtherMedicalProductsTherapeu ParamedicalServices DentalServices HospitalServices MotorCars MotorCyclesBicyclesAnimal SparesPartsAccessoriesforP FuelsLubricantsforPersonal MaintenanceRepairofPersonal OtherServicesinRespectofPer PassengerTransportbyRailway PassengerTransportbyRoad PassengerTransportbyAir PassengerTransportbySeaInl CombinedPassengerTransport OtherPurchasedTransportServic PostalServices TelephoneTelefaxEquipment EquipmentforTheReceptionRec PhotographicCinematographicE InformationProcessingEquipment RecordingMedia RepairofAudioVisualPhotogra MajorDurablesforIndoorOutd MaintenanceRepairofOtherMa GamesToysHobbies EquipmentforSportCampingO GardensPlantsFlowers PetsRelatedProductsVeterin RecreationalSportingServices CulturalServices Books NewspapersPeriodicals MiscellaneousPrintedMatterSt PackageHolidays Education RestaurantsCafesTheLike Canteens AccommodationServices HairdressingSalonsPersonalG ElectricalAppliancesforPerson JewelleryClocksWatches OtherPersonalEffects SocialProtection InsuranceConnectedwithTheDwe InsuranceConnectedwithHealth InsuranceConnectedwithTranspo OtherInsurance FinancialServicesNEC OtherServicesNEC
    pca $X, blanks (.3) 
    rotate
    matrix M = e(r_L)
    local rmax = rowsof(M)
    local cmax = colsof(M)
    forvalues r = 1/`rmax' {
         forvalues c = 1/`cmax' {
              if M[`r', `c'] < 0.3 {
                   matrix M[`r', `c'] = .
              }
         }
    }
    putexcel set "Factor Loadings Table.xlsx", sheet("Factor Loadings")
    putexcel  A1= matrix(e(Factors)) B2= matrix(M), colwise
    And example of my dataset:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double(BreadCereals Meat FishSeafood MilkCheeseEggs OilsFats Fruit Vegetables SugarJamHoneyChocolate FoodProductsNEC CoffeeTeaCocoa MineralWatersSoftDrinksF)
      .005895998453508522    .013204389064533917 .0027204914436156358   .005713741548423856  -.014386536373506953    .03308690948431314   .014985282312015125   .0014727540500736325    .005203730976926835  -.0024858307646415945    .012256057320637392
      .004450895016932854    .016261682242990627  .013384836507366327  .0029591447117218728   -.02051796461790989    .04398588107521051 -.0022659294842743982   .0035569607746270826   .0021591912847187533    -.00522613065326627    .003429878048780477
      .003580414166827861     .02169421487603307  .009811864254208436  .0023807256451766623  -.025002264697889354    .05181859003143252    .04614956908534884   .0016745468873129443   .0014717425431709508   -.005980265125087203    .005138452754781531
      .002226524685382314     .02516256714729992  .012934153400868231  .0028634150997421948  -.020890099909173454    .07208258527827649   .032258064516129004    .003163931184496649    .001866221392790468  -.0035885167464114742    .005616373155640231
     .0041682822799535835    .028050623347185555   .01289566236811246   .005065468794800632  -.017927017927017896     .0808267207971951  -.011601351968575813   .0014842667722143599     .00294753389663982   -.008160015921982233    .006670478368591581
      .004155392346347098    .030151228733459323  .012218129548108969   .006005719733079173  -.023195181156162925    .07774921975399307  -.028493894165535827    .004251952931869862   .0035197497066874472   -.004261645193260777    .009909480705097673
      .006295399515738653    .034672746271492416   .01436963398102109   .006778690089746187  -.020125786163522008    .08080161054172774  -.015209125475285079    .002869866402770871   .0047017337643255885   -.001290322580645098   .0067677056524639845
      .012890094979647104     .04439140811455844  .024961562810889015   .012631578947368327  -.015675385166606937    .11279689334417053   .027512939253609314    .010796354992076207    .012464422416331278     .00877192982456143    .015537127061290734
      .014938403336890005     .04968824940047978   .02554843369143267    .01598698066245463   -.01923933374899789    .11491752764183416   .045188058086046645    .009209744503862138    .012179550142422002   .0032705649157580563    .017930376728660047
      .016593886462882068     .05457525793076856   .04451712546561293   .012735803887771624  -.014430785676109115    .09590466282039167    .06473594548551964    .006728676034039038    .013118958374432887   .0021905805038335835     .02004581901489111
      .009819171689675388     .05167085184469755  .026624261699227603   .011315688530878276  -.027065275075181305   .055327868852458995  .0063854663189135685    .008390089823314462    .011750765280932107   -.004551751434791251     .01997705983559528
      .008769365682548935      .0454808806488991  .017424448679553617   .009707804690503474   -.03288081805359666   .053048666790975085  -.005920766216804485      .0080190080190079     .00808279940857548    -.00810677212061306    .017604286261002633
      .009759906304899424     .03963650425367371  .024177602013302213   .010391609737323115   -.02788283929985047   .039452722331552836   -.00328947368421062    .006621862028068692    .008815372424722634   -.004848604789234212    .016288205423014235
      .012639623750734685     .03662080992055805  .014490112093319851    .01022179363548692  -.030758352483648665   .029250116441546403   .008777544116302494    .007265127388534909    .012319920516641769   -.008865424843111924    .014400309268386868
      .013435324114935865    .031982942430703654  .014427906127294277   .011949503710128262   -.03302382620882971   .024473272610175734    .01029866117404743    .007842747940037587    .012617983109786346  -.0073216582566537625    .009122335317841346
       .01543300894524724     .03169664560038887  .009957065862793435   .011293436293436265   -.04435378873361684    .00586907449209928  .0007464079119239297    .004668719578821978      .0124303898170246   -.005353955978584235    .007383966244725704
      .015054609859293633    .029260231359968802  .012971590390061127    .01228715170278627    -.0490654205607477   -.02413110030614085   .028273529964305988    .006172839506172867     .01384600059766905   -.006426735218509005    .008553580009610817
       .01610369206598583    .028282631937020186  .018110308241104933    .01235282763945178   -.03387475028228948   -.03078291814946621    .09152843601895722    .004369848048465519    .012372562605166726  -.0070852194449911865    .009717144506446118
      .016040149576854956     .02452554744525548  .015603487838458108   .012665570917528735   -.03952364515015527   -.02991566799822465    .08113927767446394   .0036750099324591723     .01319968241365621  -.0065082339019820745    .010888417806899087
       .01555118110236231    .020358464835378953  .014776064610866335   .010052194084670507   -.03717119448037953   -.04625322997416015    .06880822981366452   .0036782980415548394    .010813492063492136   -.012598425196850394    .014113098115031253
       .01636596667652568    .015685892439594618   .01679823756196064    .01025145067698241  -.028301886792452935    -.0498579178506845    .05963872694255956    .004476275738585445    .011324128340121087   -.005715411903823409    .012456546929316303
      .016673243883188693    .012595196250732243  .009353507565337038   .003555640976359742  -.022040247408310787   -.04064966881408216    .07127077129958703    .004073522106308847    .006452893874714594    -.01229346970889067     .01491958922689407
      .017609814008705982    .011429129627820611  .016440380530156062  .0032711179526649925  -.013782274947662265   -.02479789263330001     .0676973305166122    .008160015921982344    .008163265306122325  -.0015807152736613261     .01307252832381156
      .016440526889174967     .01162449936504828  .020750347383047707  .0035690170734059556 -.0007047216349541641   -.01947161532132735     .1027364378300526    .006276150627615218     .00945273631840804  -.0012835703001579102    .014461807240609525
      .014053840063341205    .010649731314118283  .013389197558976162   .004251618513866129  -.014647252556768908  -.009651972157772692    .06575705893500094     .00406867123151744    .005978477481068056   -.005608580143658282      .0100648408013162
      .012098373661245443    .007417528791723749  .019606021185653244   .006209974771977489   -.01830802603036874  -.004174397031539878    .05835107412425011   .0013952561291608045   .0060975609756097615  -.0038698154395713225      .0114369501466276
      .012712285231899934    .007814026176987898   .02154850746268666     .0088469764728758  -.013566058930268743 .00027609055770283497    .05221160476800302    .002887295898048592    .004992511233150365 -.00009893153937479138    .021882052791678985
      .011836085140242592    .007345739471106727  .023084112149532654   .018181818181818077  -.012852369120041174   .019046742730953303    .04821515892420547   .0033888169042162186     .00459540459540464  -.0028670291646071266    .025267918592075667
      .011243781094527394    .009420076538122046  .018799441600744426   .019329388560157756 -.0031915811265419425   .052302444570778706     .0711339168930476   -.000994629003381875   .0039000000000000146  -.0034486156271553714     .02391261562684499
        .0119236883942766     .01050874091534082  .013816765578634982   .023003257972159075   .010089489384102368    .07027232908017522   .030105777054515892   .0018905472636816523     .00537366902179337   .0016757023164120088    .020921324034967048
       .01094309590131326    .012315270935960632  .017368568493790315    .02436367237793413   .029586850288760624     .0675701288855195   .028798711106635677    .000496869720759241    .003385779725154414   -.000985124618264277    .021557239885815482
       .01195219123505975    .014426877470355759   .02483069977426644   .027000198530871433   .055242082271569126    .07420429311621013    .02762541138924912  -.0005961251862891537    .003884075291305633    .004151017987744421     .01881032105574154
      .010762331838565231     .01603642843001385  .025993595780749557    .02885572139303494     .0688251618871416    .06609749380335983   .008190402775101191   -.000993739441518371   .0040893676441251525    .003361676883527842    .018489378442171578
      .011274069639828355    .017686804451510385   .03198637266963189    .04143314651721375    .07270348565554619    .04652929446396348   -.02546101282411306   .0027896781906944224    .008106485188150492    .011338770638551932     .01965820408969665
      .008782435129740529    .017594433399602538  .024701873935264018    .04252758274824475    .07693752935650533    .03809523809523818  -.040361223737559904  -.0008948101014117915    .006613889167251141    .003967466772465844     .01964849921011047
      .007081587871534012     .01850562133121092  .017244628722201227    .04243338360985427    .07185346048531782     .0445951107715814   -.10853376701189754  -.0005973715651135247    .005703992794956481    .005559968228753043    .017982412805058967
      .008081412750673422     .01719340091433108  .022729389846297243    .04125163497333739    .09344200151630022   .051629904352918254   -.03642837578745539   .0012917329093800056    .005409737527549696    .017826740110165273    .021249258746787847
      .005885286783042343     .01940105462143049  .027692895339954227     .0393303751512708    .09678340312143141   .052837191131946515   -.01223475434907284  -.0030799801291604423   .0018025235329461875     .01993725331444174    .014176663031624681
      .004389027431421333    .019112084411706087  .033153430994602884    .03993529471236479      .104293893129771   .048335745296671506   .007643438554695292   -.001987281399046137    .002402161945751269    .019157088122605304    .007912174859064258
      .004094676920004092    .017540362766593542   .03033220991815133    .04187999180831459    .11726976833237601    .04319447110769814   .033663566518398635   -.003377371610211566   .0032070555221486163    .020480225988700473     .00633224497872753
     .0031942503493711527     .01767525464349906   .03586233490793411    .03957350830428541    .12805293373552606   .016175621028307496  -.003808760148341195  -.0002982996917568759   .0012014417300760805    .022775370351707958    .005740300870942239
      .003389830508474523     .01657348242811496  .033346109620544295    .03632085123797846    .10488561457929446   -.01574507966260552  -.017094871538538503  -.0012918612739739599    .003495106850409435     .02144583165525593    .009218873909595526
     .0024932681759251007     .01459416233506583   .03418638338966695   .032202003680229074    .09601713896192421   -.01723013877246915   -.01419495731586251   .0015925151786602143    .003297032670596556     .02308002418867172    .007937295366603703
     .0007974481658692412     .01260756453872336   .03303536727555367   .028904095597998225    .07788895428683529  -.005337750782256512   .001398182362928102 -.00009934432743885502   .0042004200420042714    .019856869267211197      .0069416898056327
     .0008976660682225024    .011109998999099258   .03701533352866493    .02238046795523907     .0581440877055599    .01689693801344294   .010516066212268749  .00029821073558644606    .003402722177742179        .02058526740666    .008530053560801498
    -.0005982650314089177    .007911867801702721    .0312286522884746   .008172737362526439    .04880917377241989   .047547995623197004     .0249448335412068   -.004660848869496248  -.0030928863613688407    .010655408122235643    .004365512451632192
                        0    .007612179487179294  .037000687015408706   .003522898842476252   .041992952231793224    .05041600633914434   .058421925290158994   .0008956115036322654  -.0008010413537599126     .01561398206910436   .0060594020065560805
     .0009984025559106602    .006005404864378061  .036328125000000044  .0006036824630244464   .028552005438477135   .048878205128205066    .16190949776230723   .0021951706246257086  -.0011994002998499953    .013993758179804638    .003868280103154209
     .0008987417615338167    .005596642014791042  .031319050821404515 -.0002011870033195029   .024764494512964808    .03578649413667612    .09793504410585396   .0026900468267410105   -.000800800800800916    .006653896562153427    .005265772478887154
     .0013984616921387527     .00379506641366234   .03070866141732287 -.0015104219111872208   .021483425682900625    .01850193971948677   .051774404343017943   .0056954436450840085   -.001998800719568261  -.0016166515105586754    .007893685051958421
     .0016986410871302482    .004399120175964777   .03243781094527365  -.005229809916524331    .01945525291828787   .011120866256950634  -.007194244604316613    .006198760247950519    -.00139930034982505   -.002915451895043608    .013024747019336758
    .00019978024173394893   .0023976023976024496   .03302496767134189  -.018591096372224003   .022513703993735312   .015597582374732077   -.02809982314796622    .005895283772981541   -.001101211332465657  -.0026162205675185346    .013944622792937178
     .0010992305386230417   .0009996001599359428  .029987091649290143   -.01772406847935537    .01682002572474528    .03580333100628308 .00030078203328653963    .005096941834898949  -.0012000000000000899   -.005910639150470742    .013237063778580138
     .0006983936945026414  .00009985022466296734   .03996013951170907  -.018083182640144746   .029335461983635902    .05905707196029786   .045354791514264914    .006803401700850253                      0   -.014780279734153412    .012546421760513793
       .00199860097931448  .00039999999999995595  .041017392178546386  -.018561252132035855   .028545673076923128    .06443937741647665    .05564287959761072    .004900980196039129 -.00029964043148222874   -.012834543826484968    .009616347791245206
     .0026986506746626837  .00040040040040034697   .03635082066257178  -.020312187312387486    .02596618357487923   .028587656190836697    .01872011394851958      .0052931189453711                      0   -.011754158780755142    .008702610783235087
     .0029008702610784365  -.0006001800540161861  .033198789101917425  -.018276240886847095    .03077388759963684   .040000000000000036    .01452138694063021    .005095414127285425                      0   -.012357982858281935    .005786113328012821
     .0035021012607565627  -.0004004404845330267  .031196538190600753  -.014713192166219358   .027906508160386867   .027178910800040867   .013614703880190593    .007291978823294354   .0020995800839833656   -.010149253731343233    .007497001199520126
     .0036057692307691624 -.00010015022533793605  .025772676935467587  -.013210170838299673   .036105476673428116   .046434494195688014   .009749852274965498    .003495106850409435  -.0013998600139986106   -.009577970667464908   .0030888800318853438
      .004210948466011555  .00010010010009997572  .029870260484763156  -.014574657941701319    .05469630236607603   .047419219471254825     -.024827853748424   .0037055583375062984   .0009003601440575881  -.0069979006298110935   .0047837352999799965
     .0036079374624173877  .00019992003198709973   .03778664007976085  -.016132224861441058    .06078087977748026    .05032915693353157  .0034198350432508295     .00854099678456599     .00070119202644503  -.0037163519485737817     .00328947368421062
      .005120481927710863                      0  .023162134944612278    -.0190636112208612    .06711618257261409   .049921671018276825    .04113460330751506    .009685230024212954   .0007000700070007859   -.005226655945321124  -.0015961691939345712
      .004819277108433884  -.0009988014382741328   .01689770312658112  -.019041041831097005    .06783006128596658    .06792374205646423      .066757779646762     .00948728300363344  .00009996001599343884    .006475766467671784   -.006569125111973717
      .004918691025898259  -.0006988120195667857  .019160583941605802   -.02402903099254594    .06140259740259735     .0632255389718075    .09288091914528085    .008058017727639033   -.003292755936938674    .009959349593495759   -.005784959106323595
      .005526527331189746  -.0016964374812891148  .019848101265822704  -.027042915931804856    .05292217939368693     .0598245428601627    .07432141318397223    .006336115860404279   -.001697114904662067    .013503909026297167   -.006871825515386898
      .006729610285255205  -.0014955134596210673   .01774847870182561    -.0268843484211555    .04124675324675331    .05696600923206052    .06559020044543429    .003917235837685773  -.0005988023952095967    .024595995528000847  -.0075704751469269915
     .0052235057759919545   -.002792181890706069  .015932999693596184  -.024659947157256057   .036652476378361554   .048435713543290904   .025357257977866254    .003110263870773622  -.0036819584038211284    .026345348718472383   -.007752708478282466
      .005325562700964737  -.0027949690556997586  .017833350415086713  -.021539064029763133   .028890959925442772   .055450094914576864    .04098707900868459    .006129421221864995  -.0035874439461883734     .04605605918516198   -.008037308989878977
      .004118119726797875  -.0013984616921386417  .013707037643207798  -.020254403131115484   .020595201318092782    .04642893426800754    .05767422421899493    .004012438559534592   -.008139765733571558     .04618913564800331   -.006245662734212454
      .004119360996684307  -.0010999999999999899  .017405549298658674  -.014885907354813432   .019829446213911472   .009593563028677643     .0429006085192698    .006130653266331665   -.007541178805318571     .05312794718641922   -.007244219509774608
      .003013863773357439  -.0032940706727890845  .012951254334081064  -.011681554922940984   .004687181577338384   .002285476833575828   .025035332121946308   .0026031237484982483   -.010096011085816037    .044606565919749874   -.004266296259549662
      .002210610932475765   -.005178251344353679 .0008052340211375242  -.007771765863256341   -.01503228410008084   .003474049899989451   .022409519087754237   -.001300260052010449   -.011275964391691429     .03754797220205375  -.0043659456241317285
     .0024110910186858625   -.004081632653061162  .010681176944780324  -.006000983767830759  -.025597269624573538  -.014441188781917025  -.030710734132787243  -.0038038038038038513   -.009426473506648159    .035680848850514924   -.004366812227074357
     .0006027727546713546   -.003483280254777177  .017313799815592557  -.000986777185711496   -.03280826728203068  .0016738152526414307   -.05152387570733641   -.005717724947336689   -.011468116658428174    .034307100530200696  -.0012952077313939103
     .0012062726176114147   -.002093092793780449  .014577558772199906   .004359889021006813    -.0387418871692462 -.0038397675383977647   .009016654290866732   -.007114941376891504   -.009504950495049402     .01823614259221107 -.00009952229299370341
      .001004823151125489  -.0011965300628178355   .01701206309928871      .016347687400319  -.037403740374037375  -.011779166239885175 -.0020360051435919235   -.004811547714514863   -.008998318995352528    .011305241521069043   -.002487314695055254
    -.0005021592849251411 -.00009978048293757258  .013548188442984666   .023157894736842044   -.03313859790491547  -.040271860417934624  -.019744483159117254   -.004505406487785191   -.008904719501335645    .008292383292383132   .0006976280645802913
     .0008041817450743505  .00009971083856807894  .015657189946435945   .026183788121990403   -.03178754652449445   -.08486943164362526    -.0596858638743456   -.002804487179487225   -.010956470239857907    .006547314578005059    .000897308075772818
     .0006030756859987108    .003301650825412672  .011571443330922415   .026931966636518867  -.029719927463227935   -.09261529755729514   -.06509291813159224  -.0027016209725835294   -.007800157977883138  -.0003062474479378352   .0018920533758215452
     .0009051594086291193    .004109451738999903  .008371227780074264   .029740901300534306  -.025136281041792996   -.07529563932002947   -.08303389336700007  -.0015049663890840392   -.009084625259208057    -.02061434840289822   .0034850144379168224
     .0017104336452360425    .004515352197471456   .01169409086205131    .03201050186812071  -.014911746804625703  -.048985507246376736   -.07606911864079557  -.0003008423586040587   -.004840462313543514    -.01650943396226412   .0025842361594274887
     .0025181305398871423    .004318569850356502  .008987603305785186   .035073492143943064 -.0005134524543026764  -.009502401144375283    -.0400155778405219  -.0008033741715203213    -.00217821782178218    -.02988716071973163   .0012917329093800056
      .003427419354838701    .006631832797427739  .018593539004882143    .03211752786220878    .01060652867881795    -.0060918946824986   -.02691552062868363    .003214142225793415  -.0018770993874728248   -.025690495532087798    .001789086571911458
     .0035292931330039856    .009144809566877576    .0325296196217002   .029158651412372283    .02555613036730464  -.007211538461538547   .006989515726410378    .006847935548841999  -.0003954913980621644    -.02320162107396151    .002686299870659603
     .0064711830131445325    .009649210975977596   .02256568778979906   .030619486971509735     .0367363929649287   .005894736842105397    .02141007767377001    .007869249394673039    .000397061743101057   -.026334447483034595    .002487314695055254
      .007795889440113557    .011475739883229252   .01740671252866366   .028310502283105166    .03801291397625506   .008014341453126628   .028066952439273374    .006258201271827968    .002179728524720037    -.02720469255663427    .001197007481296808
      .008209182122225656     .01353672088089719  .019359564671410645   .025297165498323615     .0506714225765843   .008055235903337232   -.00757974523634064    .008591065292096411    .002381897578404013   -.017213446739570704   .0027944111776447844
       .01066314613587882    .019518145776151297  .013797428661022293   .024823781795893174     .0627059198639599   .025740701828115053  -.007867318732723838     .00920586747597385    .005268389662027806   -.018064385911797376    .004798560431870547
      .013331976389171496     .02474437627811854  .013417932182234305     .0193133047210301     .0704043126684637   .058861439312567265    .02845042892822236     .01380430369468133     .00577171857896297    -.01829145728643211     .00692423482187654
      .014687882496940086     .03020030816640995  .014420062695924774    .01859799713876975    .07679809358752165    .11305834580038465   .046460661845277196    .014015843997562616    .007157769161944438   -.017884055058776216    .007736360896212213
      .016137268920437098     .02998763396537507   .01563483735571891   .017276630545900673    .07657266811279828    .11422866750735605    .07901582484283542    .016270083384177347    .010274314214463898   -.015081439774783822    .008942027529388108
       .01687461648598898    .030149716055756448  .020998206183391543   .013383735185942047    .06895435415992224    .08685611005120997     .0889382402707275      .0133184221228142    .010678642714570863   -.014085924137237194   .0076251630380255175
      .017193736567393314     .02997106242248848   .01555438780872298   .011232513019503676   .061941182807282225    .10565110565110558    .08391754734749401    .015995924605196166    .011996401079676033     -.0193081255028158    .010647915620291437
       .01783883534960018     .03138595400870092  .019376579612468525   .004684794785619895    .04305912596401029    .07266549758877705    .05614395886889456    .016641143440530914    .010606363818290943    -.01115802171290714    .013596535401349419
       .01858507033576351     .03215100601534937   .01786847113554657   .006937359722505754   .038609625668449166    .07420141969831406    .02435097605151948     .01768373709496074    .012503751125337637   -.011939400020066215    .012274876748163743
       .01848618671048574    .032582753969077505     .019279661016949   .010641563491251338    .02961542558857988    .07602339181286566    .01737098740349463    .018775007694675327    .012108475933153118   -.006542526421741246    .014535177147471545
      .019692751830085786    .034952668261728936   .01932570108181908   .010242753252074133    .02332268370607027    .07296137339055786    .07839347079037795     .01912399753238736    .015319492037895621 -.00010127607859011789    .017204736362716355
       .02066756226103128     .03533090151120377  .012880067567567544   .010769230769230642   .020729244179866102    .06038242200603805    .07753216760145154    .023767696600186072     .01682450130969171    .004265691651432091    .023690391095680496
      .021111456069543788     .03643597529054543  .017461669505962618   .010886309951730455    .00995973723246446    .06459516649961006    .05112316034082087     .02592285358772295     .01521410579345095    .006420055029043192    .023179822322066723
      .022427577613954863      .0314564328405158  .018632879045996642  .0070987654320986415  -.004127857747671437    .06050139275766031    .07251995438996572    .027012987012986933    .016058983941015903    .010916139563354577     .02479254174777168
    end

  • #2
    I don't know much about MS Excel and nothing about what you want to do in Excel that you can't do in Stata. But https://www.statalist.org/forums/for...-for-pca-users reports a utility that exports PCA results as a dataset, which might be easier to export elsewhere than existing output.

    Comment


    • #3
      Thank you very much for the link, Nick. I can now export my pca results.

      For clarification, I am running a pca on 60 variables. After rotation I can see which variables load on which components. However, because I am running the pca on so many variables it is taking a long time for me to see which "group" of variables load on comp 1, comp 2, comp 3 etc so I can rename these components with something more informative (for example, dairy prices, fuel prices etc.). I have not been able to find a way to do this on Stata - as in where Stata can produce a list of variable names for each component with say a factor loading greater that .3 etc. I hope that makes sense...

      Comment


      • #4
        pcacoefsave (SSC) can help there too, as you can just select observations (meaning variable, component pairs) with loadings of interest.

        There probably should be a version based on frames that lets you flip back and forth between data and results sets. That is not going to happen soon, but an alternative would be to write your own command that shows the results you want..

        Comment


        • #5
          Thanks Nick

          Comment

          Working...
          X