sas - How to find a regression line for each year? -


i have data set:

"country" "year" "gdp.per.capita" "infant.mortality.rate" "argentina" 1950 6252.85859891315 68 "australia" 1950 10031.1213832996 25.1 "austria" 1950 5733.09811393918 66 "belgium" 1950 7990.46583983014 53 "benin" 1950 1104.46653022144 204.8 "burkina faso" 1950 515.707854373329 178.7 "canada" 1950 10581.265520182 41.2 "chile" 1950 3713.9960324847 147.7 "colombia" 1950 2087.94941987793 124 "denmark" 1950 8996.05428012913 29.1 "finland" 1950 5845.6263157204 44 "france" 1950 7104.00732497357 47.6 "ghana" 1950 943.100536353646 150.1 "greece" 1950 3040.41319387776 35 

i wrote script upload data the internet. , want regression: log(infant_mortality_rate) = country log(gdp_per_capita) each year.

filename regproj url "http://www.math.tau.ac.il/~liadshek/long.txt" ; data book; length country $20; infile regproj firstobs=2 dlm=" " lrecl=131072 dsd truncover; input country$ year gdp_per_capita infant_mortality_rate; run;  proc reg ; model log(infant_mortality_rate) = country log(gdp_per_capita); output out = reg1; run; 

my problem is: how each year , save estimates in different table. in short code? (there 62 years in full data set).

proc reg has statement, sas procedures. allow perform regression once per year in 1 set.

filename regproj url "http://www.math.tau.ac.il/~liadshek/long.txt" ; data book; length country $20; infile regproj firstobs=2 dlm=" " lrecl=131072 dsd truncover; input country$ year gdp_per_capita infant_mortality_rate; log_imr = log(infant_mortality_rate); log_gdp = log(gdp_per_capita); run;  proc reg data=book; year; model log_imr = log_gdp; output out = reg1; run; 

that gives 1 dataset, purposes can work there fine, depending on you're doing after that. @ minimum write macro set 62 datasets, in cases 1 dataset 62 years better, using processing further analyses.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -