DATA Step, Macro, Functions and more

multiple imputation

Reply
Contributor
Posts: 39

multiple imputation

[ Edited ]

The following is the code I imputed and the log. And the attached is the original data I used.  I want to use quarter data to impute weekly data but there is something wrong. I refer to "Multiple Imputation for Missing Data: Concepts and News Development". The attached is the data which has more information because it starts in 2008 quarterly, and I don't know whether it will be useful for monotone or not.

input date	search_volume	open_price	volume	mood_prive	mood_economic	mood_government	mood_investment	mood_global	mood_possibility
;
informat date yymmdd.;
format date yymmdd10.;
datalines;
2013-12-29	31265.96873	8585.37	8868976	.	.	.	.	.	.
2014-01-05	27950.70473	8553	25542285	.	.	.	.	.	.
2014-01-12	25902.91541	8587.49	23798004	.	.	.	.	.	.
2014-01-19	23850.62263	8595.59	21013310	.	.	.	.	.	.
2014-01-26	16471.45342	8519.48	4003706	102.6	86.4	108.3	94.6	117.5	113.7
2014-02-02	18413.8849	8290.17	13577988	.	.	.	.	.	.
2014-02-09	22096.8015	8416.42	20932955	.	.	.	.	.	.
2014-02-16	21174.52948	8537.83	20897446	.	.	.	.	.	.
2014-02-23	19110.34379	8603.61	18451389	.	.	.	.	.	.
2014-03-02	20039.02689	8627.15	23866751	.	.	.	.	.	.
2014-03-09	20082.52542	8706.43	21628830	.	.	.	.	.	.
2014-03-16	18755.35847	8697.26	22388151	.	.	.	.	.	.
2014-03-23	18181.1214	8540.27	22001681	.	.	.	.	.	.
2014-03-30	16583.05049	8802.93	18635131	.	.	.	.	.	.
2014-04-06	17277.2075	8844.91	23653011	.	.	.	.	.	.
2014-04-13	16706.70072	8897.23	21848387	.	.	.	.	.	.
2014-04-20	16448.80356	8961.52	25353783	.	.	.	.	.	.
2014-04-27	15159.39418	8680.14	19053126	.	.	.	.	.	.
2014-05-04	16407.68482	8895.87	24751657	.	.	.	.	.	.
2014-05-11	15863.96562	8893.72	21302355	.	.	.	.	.	.
2014-05-18	14733.00752	8901.54	21286694	.	.	.	.	.	.
2014-05-25	14988.46355	9040.49	25196797	100.6	84.7	94.2	93.5	117.6	117.4
2014-06-01	13836.44918	9106.61	21298265	.	.	.	.	.	.
2014-06-08	14721.77203	9153.93	25439138	.	.	.	.	.	.
2014-06-15	14364.49877	9196.23	25290129	.	.	.	.	.	.
2014-06-22	14247.61966	9293.06	24519615	.	.	.	.	.	.
2014-06-29	13867.25553	9332.44	31407426	.	.	.	.	.	.
2014-07-06	13952.17408	9497.27	31082280	.	.	.	.	.	.
2014-07-13	13606.93546	9497.81	30163910	.	.	.	.	.	.
2014-07-20	12365.85288	9453.78	22175631	.	.	.	.	.	.
2014-07-27	13382.69317	9415.9	31581958	.	.	.	.	.	.
2014-08-03	13215.86645	9280.29	28543120	.	.	.	.	.	.
2014-08-10	12929.63734	9109.83	26019178	.	.	.	.	.	.
2014-08-17	12262.72744	9222.73	26300484	106	95.6	101.7	99.6	110.8	118.2
2014-08-24	11969.15285	9393.24	28277607	.	.	.	.	.	.
2014-08-31	12274.05186	9474.41	24938544	.	.	.	.	.	.
2014-09-07	11168.15524	9452.14	18875091	.	.	.	.	.	.
2014-09-14	10709.79633	9206.41	22890528	.	.	.	.	.	.
2014-09-21	10817.08069	9220.54	25272005	.	.	.	.	.	.
2014-09-28	10663.75135	9018.46	25827744	.	.	.	.	.	.
2014-10-05	9763.12662	9118.28	18627350	.	.	.	.	.	.
2014-10-12	10960.82462	8767.42	29734551	.	.	.	.	.	.
2014-10-19	9997.050868	8617.08	23795287	91	79.5	94.5	87.1	99.7	105.1
2014-10-26	9944.235397	8671.51	26800560	.	.	.	.	.	.
2014-11-02	9784.14586	9009.38	26105437	.	.	.	.	.	.
2014-11-09	9546.99488	8937.59	26419817	.	.	.	.	.	.
2014-11-16	9244.900155	9003.37	26437142	.	.	.	.	.	.
2014-11-23	8808.63662	9144.42	24429230	.	.	.	.	.	.
2014-11-30	9175.051622	9038.41	30591366	.	.	.	.	.	.
2014-12-07	9101.637737	9231.24	26818238	.	.	.	.	.	.
2014-12-14	9172.5426	8987.95	27376696	.	.	.	.	.	.
2014-12-21	9123.711552	9032.42	28035931	.	.	.	.	.	.
2014-12-28	7537.97184	9216.43	12659602	.	.	.	.	.	.
2015-01-04	8631.193364	9292.31	28375399	.	.	.	.	.	.
2015-01-11	8838.39816	9198.02	27159441	.	.	.	.	.	.
2015-01-18	9033.024336	9183.76	28166155	.	.	.	.	.	.
2015-01-25	8806.864325	9474.56	24158921	107.4	104.3	100.1	103	106.3	112.9
2015-02-01	8292.73749	9368.83	22232706	.	.	.	.	.	.
2015-02-08	8117.578392	9465.12	19033502	.	.	.	.	.	.
2015-02-22	6591.595891	9582.39	13351786	.	.	.	.	.	.
2015-03-01	7429.726695	9665.11	22863592	.	.	.	.	.	.
2015-03-08	8641.626314	9617.04	24552198	.	.	.	.	.	.
2015-03-15	8644.147128	9583.45	26949243	.	.	.	.	.	.
2015-03-22	8632.189365	9759.88	26912945	.	.	.	.	.	.
2015-03-29	8322.389316	9533.38	19524422	.	.	.	.	.	.
2015-04-05	7574.663565	9619.97	19816370	.	.	.	.	.	.
2015-04-12	7734.082764	9622.64	26447471	.	.	.	.	.	.
2015-04-19	8239.993245	9541.83	31624373	.	.	.	.	.	.
2015-04-26	7965.947754	9941.18	24944950	103.7	97.8	102.2	100.5	115.8	118.6
2015-05-03	7611.97648	9853.51	27094159	.	.	.	.	.	.
2015-05-10	7948.371142	9763.94	27128808	.	.	.	.	.	.
2015-05-17	8049.740643	9603.75	28939396	.	.	.	.	.	.
2015-05-24	7569.963872	9654.28	28573397	.	.	.	.	.	.
2015-05-31	7514.023004	9688.13	30180031	.	.	.	.	.	.
2015-06-07	7687.393563	9324.22	27126930	.	.	.	.	.	.
2015-06-14	7915.602594	9304.66	18257928	.	.	.	.	.	.
2015-06-21	6886.880676	9247.76	24704046	.	.	.	.	.	.
2015-06-28	7376.858034	9358.96	23717485	.	.	.	.	.	.
2015-07-05	7046.740272	9309.86	23967947	.	.	.	.	.	.
2015-07-12	6616.456938	8946.72	25460751	.	.	.	.	.	.
2015-07-19	6883.896656	9085	24447954	.	.	.	.	.	.
2015-07-26	6811.449276	8733.24	27039490	.	.	.	.	.	.
2015-08-02	6726.622821	8636.53	24571823	.	.	.	.	.	.
2015-08-09	6190.303924	8410.63	25408867	81.4	69.1	83.7	69.6	92.4	93.1
2015-08-16	6614.64462	8307.9	24447475	.	.	.	.	.	.
2015-08-23	6496.243056	7719.63	30520394	.	.	.	.	.	.
2015-08-30	6772.360023	8026.62	24077331	.	.	.	.	.	.
2015-09-06	6770.10926	7990.76	22013661	.	.	.	.	.	.
2015-09-13	6673.061307	8332.57	20866061	.	.	.	.	.	.
2015-09-20	6459.860415	8404.5	19706723	.	.	.	.	.	.
2015-09-27	6303.013815	8097.15	13054665	.	.	.	.	.	.
2015-10-04	5344.697037	8342.99	18792859	.	.	.	.	.	.
2015-10-11	5971.639212	8478.34	23650100	.	.	.	.	.	.
2015-10-18	6417.000734	8628.79	22119488	84.7	64.1	86.6	73.7	91.2	97.6
2015-10-25	6091.730304	8706.81	21924824	.	.	.	.	.	.
2015-11-01	5904.13722	8571.53	26349460	.	.	.	.	.	.
2015-11-08	6116.07632	8702.67	22765949	.	.	.	.	.	.
2015-11-15	5822.92998	8278.12	21620246	.	.	.	.	.	.
2015-11-22	5767.492714	8480.59	19569438	.	.	.	.	.	.
2015-11-29	5731.552584	8339.83	23294483	.	.	.	.	.	.
2015-12-06	5951.292566	8432.47	22101131	.	.	.	.	.	.
2015-12-13	5652.626049	8058.67	21747690	.	.	.	.	.	.
2015-12-20	5785.745716	8228.05	20148726	.	.	.	.	.	.
2015-12-27	5513.3874	8374.18	11155757	.	.	.	.	.	.
2016-01-03	5094.713425	8315.79	23320302	.	.	.	.	.	.
2016-01-10	5527.809588	7855.8	21796331	.	.	.	.	.	.
2016-01-17	5461.9691	7678.67	21952700	.	.	.	.	.	.
2016-01-24	5318.710272	7813.73	25737476	.	.	.	.	.	.
2016-01-31	5400.46584	8164.24	11065498	.	.	.	.	.	.
2016-02-14	4178.142814	7976.65	21610384	.	.	.	.	.	.
2016-02-21	5427.485784	8315.79	21590153	85.5	79.6	91.7	85.3	82.9	90
2016-02-28	5371.5115	8381.38	20276948	.	.	.	.	.	.
2016-03-06	5165.937	8656.74	25154913	.	.	.	.	.	.
2016-03-13	5740.33275	8746.48	26346648	.	.	.	.	.	.
2016-03-20	5487.371846	8826.16	20686409	.	.	.	.	.	.
2016-03-27	5348.992638	8713.72	20414566	.	.	.	.	.	.
2016-04-03	5426.780965	8605.16	12636153	.	.	.	.	.	.
2016-04-10	4641.285	8518.96	20740481	.	.	.	.	.	.
2016-04-17	5279.359605	8681.8	20052962	.	.	.	.	.	.
2016-04-24	5220.884313	8541.14	17270378	.	.	.	.	.	.
2016-05-01	5028.013578	8362.35	15836163	.	.	.	.	.	.
2016-05-08	4828.00368	8156.65	19280986	75.4	71.3	72.7	75.6	90	95.8
2016-05-15	4990.55814	8035.21	16278554	.	.	.	.	.	.
2016-05-22	4925.14642	8150.38	19228712	.	.	.	.	.	.
2016-05-29	4966.103024	8476.62	22543549	.	.	.	.	.	.
2016-06-05	5009.6448	8605.15	10720144	.	.	.	.	.	.
2016-06-12	4435.354066	8634.24	17486184	.	.	.	.	.	.
2016-06-19	4728.062988	8612.26	18839181	.	.	.	.	.	.
2016-06-26	4876.042706	8406.29	20706989	.	.	.	.	.	.
2016-07-03	4765.53658	8728.32	14677240	.	.	.	.	.	.
2016-07-10	4288.459904	8728.23	23517389	.	.	.	.	.	.
2016-07-17	4874.674527	8952.61	23231017	.	.	.	.	.	.
2016-07-24	4955.11527	9030.36	21522357	.	.	.	.	.	.
2016-07-31	4766.036	9008.74	19646459	.	.	.	.	.	.
2016-08-07	4671.079296	9123.07	21151658	.	.	.	.	.	.
2016-08-14	4751.418455	9152.36	20933658	.	.	.	.	.	.
2016-08-21	4553.755556	9004.68	19106001	.	.	.	.	.	.
2016-08-28	4579.152453	9117.53	20176085	.	.	.	.	.	.
2016-09-04	4650.93738	9032.38	23003485	.	.	.	.	.	.
2016-09-11	4853.76	9031.51	10761177	.	.	.	.	.	.
2016-09-18	3653.548384	9003.41	18435835	.	.	.	.	.	.
2016-09-25	4451.08752	9229.34	9774466	.	.	.	.	.	.
2016-10-02	3707.56604	9219.52	15190060	.	.	.	.	.	.
2016-10-09	4481.242982	9311.79	14099344	.	.	.	.	.	.
2016-10-16	4135.71384	9150.67	16867995	.	.	.	.	.	.
2016-10-23	4343.89755	9333.94	16375082	.	.	.	.	.	.
2016-10-30	4125.372995	9283.2	14558306	76.9	70.8	64.9	74.3	97.7	101.1
2016-11-06	4042.326155	9102.97	21524824	.	.	.	.	.	.
2016-11-13	4142.02584	8955.27	19979138	.	.	.	.	.	.
2016-11-20	4099.25934	9009.78	20371341	.	.	.	.	.	.
2016-11-27	4156.382672	9167.33	21357464	.	.	.	.	.	.
2016-12-04	4230.616248	9194.46	19210242	.	.	.	.	.	.
2016-12-11	4051.17895	9402.05	18793745	.	.	.	.	.	.
2016-12-18	4166.231112	9316.06	15937816	.	.	.	.	.	.
2016-12-25	3994.563776	9088.99	12375581	.	.	.	.	.	.
;
proc mi data = final seed=899603 out=miout_final;
var mood_economic	mood_government	 mood_investment 	mood_global	 mood_possibility;
monotone
reg(mood_economic	mood_government	 mood_investment 	mood_global	 mood_possibility);
run;
proc print data=miout_final;
run;

<log>

685  data final;
686  input date  search_volume   open_price  volume  mood_prive  mood_economic   mood_government mood_investment
686! mood_global mood_possibility
687  ;
688  informat date yymmdd.;
689  format date yymmdd10.;
690  datalines;

NOTE: The data set WORK.FINAL has 155 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds


846  ;
847  proc mi data = final seed=899603 out=miout_final;
848  var mood_economic   mood_government  mood_investment    mood_global  mood_possibility;
849  monotone
850  reg(mood_economic   mood_government  mood_investment    mood_global  mood_possibility);
851  run;

WARNING: The imputed variable mood_economic in the MONOTONE statement is the leading variable in the VAR list. Missing
         values for this variable will not be imputed.
WARNING: The default number of imputations has been changed from 5 to 25.
ERROR: Each observation has analysis variables either all missing or all observed in the data set.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MIOUT_FINAL may be incomplete.  When this step was stopped there were 0 observations and 11
         variables.
WARNING: Data set WORK.MIOUT_FINAL was not replaced because this step was stopped.
NOTE: PROCEDURE MI used (Total process time):
      real time           0.08 seconds
      cpu time            0.04 seconds



852  proc print data=miout_final;
853  run;

NOTE: No observations in data set WORK.MIOUT_FINAL.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


Attachment
Contributor
Posts: 57

Re: multiple imputation

Soooooo, what's your question?

Contributor
Posts: 39

Re: multiple imputation

I want to higher the frequency of data from quarter to week. As you can see above, the mood data are merely quarterly.

Contributor
Posts: 57

Re: multiple imputation

Are you able to make assumptiosn about the distribution of weekly  frequencies?  Can they be assumed to be uniformly distributed throughout any given month?

Contributor
Posts: 39

Re: multiple imputation

Can I get every distribution from the quarterly data and then mimic weekly data? Where can I find such codes?

Ask a Question
Discussion stats
  • 4 replies
  • 191 views
  • 0 likes
  • 2 in conversation