I have 3 macros full of ticker symbols.
stock1
stock2
stock3
Each relates to a region region 1, 2 and 3 respectively.
I want to run the stocks through the macro in order of the stock with the highest predicted returns. When I run this through I want to drop the correct region for each share into file name below to collect the files from the correct places.
This will mean my output is aligned to my input.
I have the following dataset with code: -
I'm getting the following error.....
(Source: Yahoo Finance!)
file /Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/Equities/Sector1/Region1/ .dta not found
(Source: Yahoo Finance!)
file /Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/Equities/Sector1/Region2/2670.dta not found
(Source: Yahoo Finance!)
file /Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/Equities/Sector1/Region3/4813.dta not found
(Source: Yahoo Finance!)
file /Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/Equities/Sector1/Region/6087.dta not found
(Source: Yahoo Finance!)
file /Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/Equities/Sector1/Region/6565.dta not found
(Source: Yahoo Finance!)
etc etc
stock1
stock2
stock3
Each relates to a region region 1, 2 and 3 respectively.
I want to run the stocks through the macro in order of the stock with the highest predicted returns. When I run this through I want to drop the correct region for each share into file name below to collect the files from the correct places.
This will mean my output is aligned to my input.
I have the following dataset with code: -
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str9 StockCode float(p_Model1 site) "3A2" 16.046179 3 "AZZVF" 16.046179 1 "R8G" 10.384218 3 "R8G" 10.384218 3 "F1D" 4.277653 3 "FLNDF" 4.277653 1 "BCN" 1.7931292 3 "BCRMF" 1.7931292 1 "EEYMF" 1.25635 1 "HFSRF" 1.2384268 1 "MSB" 1.1480607 1 "GS5" 1.0767547 3 "GSS" 1.0767547 1 "6G4" 1.0551568 3 "5AM" 1.0237685 3 "PXPEF" .898391 1 "NGVT" .7022493 1 "OEC" .6866636 1 "OEC" .6866636 1 "VRS" .6375682 3 "BNB" .6205041 3 "BYRSF" .6205041 1 "MF6X" .6187902 3 "BKY" .58502084 3 "GRA" .58000416 1 "CC" .55615383 1 "CC" .55615383 1 "KOP" .55576825 1 "4B8" .54208446 3 "KAZ" .4982034 3 "AVY" .4978487 1 "ARCH" .4870843 1 "SCPA" .4794053 3 "CRPR" .4788359 3 "CRDA" .4755772 3 "SMG" .4718292 1 "FOE" .4664374 1 "AXTA" .46148485 1 "NEU" .454123 1 "CCF" .4478839 1 "CCF" .4478839 1 "CBM" .445943 1 "CBM" .445943 1 "FXPO" .445387 3 "FMC" .4400076 1 "NL" .438312 1 "ASIX" .4360653 1 "BASA" .4299021 3 "HCC" .4263625 1 "FMSA" .4247648 1 "IMDZF" .4230024 1 "TET" .422565 3 "PX" .4219591 1 "SCCO" .4200784 1 "MMLTF" .4196371 1 "IFF" .419348 1 "FCX" .4189484 1 "FCX" .4189484 1 "FPM.B" .4189484 3 "FCX" .4189484 1 "FPM.B" .4189484 3 "FPM.B" .4189484 3 "TTTRF" .4157627 1 "UNVR" .4129726 1 "POL" .4109377 1 "SQM" .410175 1 "ECL" .4075709 1 "RBTEF" .4065716 1 "QYM" .405989 3 "DTI" .4053736 3 "GPL" .4040587 1 "GCP" .4029003 1 "TSE" .40277445 1 "OCI" .4021893 3 "OCINF" .4021893 1 "DEL" .4012251 1 "DEL" .4012251 1 "4975" .401096 2 "RRS" .4008736 3 "GFM" .4001553 3 "IFF" .3999876 3 "KWR" .3999051 1 "DQ" .3991729 1 "SYX" .3986178 3 "8090" .3975058 2 "CDFQF" .3969396 1 "CDFQF" .3969396 1 "CDFQF" .3969396 1 "TSDOF" .3946417 1 "SYT" .3941617 1 "CE" .392188 1 "CE" .392188 1 "CE" .392188 1 "7637" .3918008 2 "OMN" .3912422 1 "4611" .3894786 2 "4971" .3884892 2 "TTNMF" .3883018 1 "5727" .3883018 2 "UMI" .3881032 3 end preserve keep if site == 1 levelsof StockCode, local(stock2) restore, preserve keep if site == 2 levelsof StockCode, local(stock2) restore, preserve keep if site == 3 levelsof StockCode, local(stock3) restore levelsof site, local(site1) local stock "`stock1'" "`stock2'" "`stock3'" local site1 "1 2 3" tokenize `"`site1'"' foreach s of local stock { capture noisily { use "/Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/STATA Data 4.dta", replace merge 1:1 Date using "/Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/Equities/Sector1/Region`1'/`s'.dta", nogenerate } macro shift }
(Source: Yahoo Finance!)
file /Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/Equities/Sector1/Region1/ .dta not found
(Source: Yahoo Finance!)
file /Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/Equities/Sector1/Region2/2670.dta not found
(Source: Yahoo Finance!)
file /Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/Equities/Sector1/Region3/4813.dta not found
(Source: Yahoo Finance!)
file /Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/Equities/Sector1/Region/6087.dta not found
(Source: Yahoo Finance!)
file /Users/gilesgerman/Documents/Stokpix/StokpixModels/Model2/Equities/Sector1/Region/6565.dta not found
(Source: Yahoo Finance!)
etc etc
Comment