'get the data import .\2022-04.csv ftype=ascii rectype=crlf skip=0 fieldtype=delimited delim=comma colhead=2 namepos=custom colheadnames=("Name","Description") eoltype=pad badfield=NA @freq M 1959M01 @smpl @all 'create a group object that includes all the variables of interest %sers = @wlookup("*","series") group zgr.add {%sers} zgr.drop sasdate 'transform the data group zgrfinal for !i=1 to zgr.@count %ser = zgr.@seriesname(!i) %sern = %ser+"_n" %tcode = {%ser}.@description if @val(%tcode)=7 then series {%sern} = {%ser}/{%ser}(-1) {%sern}(1) = 1 else if @val(%tcode)<4 then series {%sern} = {%ser} else series {%sern} = 100*@log({%ser}) endif endif zgrfinal.add {%sern} next 'sample period %sample = "1960m01 2021m12" 'run the add-in zgrfinal.hxprincomp(apply=2,type=3,pval=12,hval=24,nfactors=8,sample={%sample},balanced,normals,cycles,loadings) 'produce lower panel of figure 7 in the paper smpl %sample group grpcomp.add pcomp_1 pcomp_2 'group the first two principal components freeze(mode=overwrite,chart_pcomps) grpcomp.line(m) chart_pcomps.addtext(1.95,-0.54,x,fillcolor(white),framecolor(white)) "PC1 of cyclical components" chart_pcomps.addtext(1.95,2.95,x,fillcolor(white),framecolor(white)) "PC2 of cyclical components" chart_pcomps.recshade smpl @all