cd C:\Users\zanghier\Documents\Data\MACRO\US\MODELS

close @wf
close @prg

wfopen fed_monitor

pagecreate(page=FRED_MD) m 1959 2026M12


import C:\Users\zanghier\Documents\Data\MACRO\US\MODELS\FREDMD.csv ftype=ascii rectype=crlf skip=0 fieldtype=delimited delim=comma colhead=2 namepos=custom colheadnames=("Name","Transform") eoltype=pad badfield=NA @freq M 1959M01 @smpl @all


        'perform transformations
        %serlist = @wlookup("*", "series")

        for %j {%serlist}
            %tform = {%j}.@attr("Transform:")
            if @len(%tform) then
                if %tform="1" then
                    series temp = {%j}  'no transform
                endif
                if %tform="2" then
                    series temp = d({%j})  'first difference
                endif
                if %tform="3" then
                    series temp = d({%j},2) 'second difference
                endif
                if %tform="4" then
                    series temp = log({%j}) 'log
                endif
                if %tform= "5" then
                    series temp = dlog({%j}) 'log difference
                endif
                if %tform= "6" then
                    series temp = dlog({%j},2)  'log second difference
                endif
                if %tform= "7" then
                    series temp = d({%j}/{%j}(-1) -1)  'other
                endif
            
              series {%j}_x = temp
                d temp		
            endif
       
 next


