Help using Base SAS procedures

Dummy dataset output

Reply
New Contributor
Posts: 2

Dummy dataset output

Hi,

I need help in creating a dummy dataset with days 1-10 and each day with 4 timepoints for each subject. I have to merge this dummy dataset back to the original dataset so that I can get all the missing days and respective timepoints in the original dataset. Can someone help me in creating the dummy dataset with arrays. Dummy dataset should look like below one

subejct day timepoint

10000     1     1

10000     1     2

10000     1     3

10000     1     4

10000     2     1

10000     2     2

10000     2     3

10000     2     4

10000     3     1

10000     3     2

10000     3     3

10000     3     4  and so on

Thanks,

Pradev

SAS Super FREQ
Posts: 8,776

Re: Dummy dataset output

Hi:

  I'm not sure you need an array. It seems to me a DO loop would be the best way to generate a dummy dataset. Something like what's shown below....it generates one observation for every subject/day/timepoint -- with 4 timepoints and 10 days per subject.

cynthia

data dummydata;

  do subject = 10000 to 15000 by 2500;

    do day = 1 to 10 by 1;

      do timepoint = 1 to 4 by 1;

         output;

      end;

    end;

  end;

run;

        

proc print data=dummydata ;

  var subject day timepoint;

run;

New Contributor
Posts: 2

Re: Dummy dataset output

Thank you Cynthia. This is exactly what I need.

Regards

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