BookmarkSubscribeRSS Feed
pradev
Calcite | Level 5

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

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

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;

pradev
Calcite | Level 5

Thank you Cynthia. This is exactly what I need.

Regards

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 999 views
  • 0 likes
  • 2 in conversation