1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
* Q : the dates, which look perfectly fine in the data entry window, appear as asterisks on the chart. * Answer: by email@example.com. * Create data file for illustration purposes (as in AnswerNet solution ID 100000483). new file. input program. loop #i = 1 to 1000. compute sub_date = xdate.date(rv.uniform(date.dmy(15,1,2000),date.dmy(15,3,2000))). end case. end loop. end file. end input program. execute. formats sub_date (adate10). *suppose surveys were submitted starting on Jan 15,2000; enter this date in the formula below. COMPUTE nb_days=CTIME.DAYS(sub_date-DATE.DMY(15,1,2000))+1. * nb_days is the number of days since the first submission date (where the first date is numbered 1). * if the responses came over an extended period, you could compute nb_weeks or nb_months instead of nb_days. AGGREGATE /OUTFILE=* /BREAK=nb_days /nb_resp = N(sub_date). GRAPH /LINE(SIMPLE)=MEAN(nb_resp) BY nb_days /MISSING=REPORT. *Depending on the number of nb_days, you may wish to consider using bars instead of lines. GRAPH /BAR(SIMPLE)=MEAN(nb_resp) BY nb_days /MISSING=REPORT. *scatter plots is also an alternative. GRAPH /SCATTERPLOT(BIVAR)=nb_days WITH nb_resp /MISSING=LISTWISE . *you will see that scatter plots has an advantage over the 2 other type of graphs: scatter plots contains empty spaces on the x axis when there are no sub_dates. *to have the same result with the first 2 types of graphs, you need to enter one dummy case for each missing value of nb_days. Say for instance that you have results for nb_days equal to 1, 2,4,5,..,10 (in other words you are missing values for nb_days=3), you would then enter (manually) a case at the bottom of the data editor with a value of nb_days=3 and value of nb_resp=0.